diff --git a/packages/web/src/commands/stdCommands.ts b/packages/web/src/commands/stdCommands.ts index c2902ff8d..cfec076db 100644 --- a/packages/web/src/commands/stdCommands.ts +++ b/packages/web/src/commands/stdCommands.ts @@ -266,11 +266,16 @@ registerCommand({ name: 'JSON Lines', menuName: 'New JSON lines file', onClick: () => { - openNewTab({ - title: 'Lines #', - icon: 'img archive', - tabComponent: 'JsonLinesEditorTab', - }); + openNewTab( + { + title: 'Lines #', + icon: 'img archive', + tabComponent: 'JsonLinesEditorTab', + }, + { + editor: '{"col1": "val1", "col2": "val2"}', + } + ); }, }); diff --git a/packages/web/src/tabs/JsonLinesEditorTab.svelte b/packages/web/src/tabs/JsonLinesEditorTab.svelte index 3bf4b3bf7..1ff6d16ef 100644 --- a/packages/web/src/tabs/JsonLinesEditorTab.svelte +++ b/packages/web/src/tabs/JsonLinesEditorTab.svelte @@ -34,6 +34,24 @@ testEnabled: () => getCurrentEditor() != null, onClick: () => getCurrentEditor().preview(), }); + + registerCommand({ + id: 'jsonl.previewNewTab', + category: 'JSON Lines editor', + name: 'Preview in new tab', + icon: 'icon preview', + testEnabled: () => getCurrentEditor() != null, + onClick: () => getCurrentEditor().previewMewTab(), + }); + + registerCommand({ + id: 'jsonl.closePreview', + category: 'JSON Lines editor', + name: 'Close preview', + icon: 'icon close', + testEnabled: () => getCurrentEditor()?.isPreview(), + onClick: () => getCurrentEditor().closePreview(), + }); - setEditorData(e.detail)} - on:focus={() => { - activator.activate(); - invalidateCommands(); - }} - bind:this={domEditor} - mode="json" - /> + + + setEditorData(e.detail)} + on:focus={() => { + activator.activate(); + invalidateCommands(); + }} + bind:this={domEditor} + mode="json" + /> + + + {#if jslid} + {#key jslid} + + {/key} + {/if} + + + - + + +