add json improved

This commit is contained in:
Jan Prochazka
2021-12-05 12:54:35 +01:00
parent de7275c38b
commit b4e777018e
3 changed files with 42 additions and 29 deletions

View File

@@ -12,20 +12,32 @@
export let onSave;
export let json;
export let showPasteInfo;
let value;
let editor;
onMount(() => {
value = JSON.stringify(json, undefined, 2);
if (json) {
value = JSON.stringify(json, undefined, 2);
} else {
// editor.getEditor().execCommand('paste');
}
});
</script>
<FormProvider>
<ModalBase {...$$restProps}>
<div slot="header">Edit JSON value</div>
{#if showPasteInfo}
<div class="m-2">
Edit JSON object or array. You can paste JSON array or object directly into data grid, new row(s) will be added
to recordset.
</div>
{/if}
<div class="editor">
<AceEditor mode="json" bind:value />
<AceEditor mode="json" bind:value bind:this={editor} />
</div>
<div slot="footer">