{#if !$activeNote}

Select a note or create a new one

Ctrl+N New note Ctrl+P Quick open
{:else}
{ if (e.key === 'Tab') { e.preventDefault(); editor?.commands.focus('start'); } if (e.key === 'Enter') { e.preventDefault(); editor?.commands.focus('start'); } }} onchange={(e) => { if ($activeNote) { const newTitle = (e.target as HTMLInputElement).value; $activeNote.meta.title = newTitle; // Update the note list entry so the 2nd panel reflects the change notes.update(list => list.map(n => n.path === $activeNotePath ? { ...n, meta: { ...n.meta, title: newTitle } } : n )); $editorDirty = true; autoSave(); } }} />
{#if $editorDirty} Unsaved {/if} {#if readOnly} View Mode {/if} {#if $appConfig?.enable_wiki_links} {/if} {#if $appConfig?.ai_provider && ($appConfig?.ai_api_key || $appConfig?.openai_api_key)} {/if}
{#if noteSearchOpen} {/if}
{#if $sourceMode} {:else}
{ closeLinkContextMenu(); handleEditorClick(e); }} oncontextmenu={handleEditorContextMenu} onkeydown={(e) => { if (readOnly && !e.ctrlKey && !e.metaKey && !e.altKey && e.key.length === 1) { readOnlyFlash = true; setTimeout(() => { readOnlyFlash = false; }, 600); } }}>
{/if}
{#if showHistory}

Version History

{#if historyLoading}
Loading...
{:else if historyVersions.length === 0}
No versions yet. Versions are created automatically as you edit (at least 5 minutes apart).
{:else}
{#each historyVersions as v} {/each}
{/if} {#if historySelected && historyPreview !== null}
{/if}
{/if}
{#if editorReady && !$sourceMode}
{ headingDropdown = false; colorDropdown = false; highlightDropdown = false; tablePickerOpen = false; alignDropdown = false; insertDropdown = false; }}>
{#if insertDropdown}
e.stopPropagation()}>
{/if}
{#if headingDropdown}
e.stopPropagation()}>
{/if}
{#if colorDropdown}
e.stopPropagation()}> {#each textColors as color} {/each}
{/if}
{#if tablePickerOpen}
e.stopPropagation()}>
{#each Array(8) as _, r} {#each Array(10) as _, c}
tablePickerHover = { rows: r + 1, cols: c + 1 }} onclick={() => insertTable(r + 1, c + 1)} >
{/each} {/each}
{tablePickerHover.rows > 0 ? `${tablePickerHover.rows} x ${tablePickerHover.cols}` : 'Select size'}
{/if}
{#if highlightDropdown}
e.stopPropagation()}> {#each highlightColors as color} {/each}
{/if}
{#if alignDropdown}
e.stopPropagation()}>
{/if}
{/if} {/if} { const file = (e.target as HTMLInputElement).files?.[0]; if (file) insertImage(file); (e.target as HTMLInputElement).value = ''; }} /> { const file = (e.target as HTMLInputElement).files?.[0]; if (file) { if (file.type.startsWith('image/')) insertImage(file); else if (file.type === 'application/pdf') insertPdf(file); else insertFileAttachment(file); } (e.target as HTMLInputElement).value = ''; }} />
{#if linkContextMenu} {/if} {#if textContextMenu}
e.stopPropagation()}>
ctxHeadingSubmenu = true} onmouseleave={() => ctxHeadingSubmenu = false}> {#if ctxHeadingSubmenu}
{/if}
{#if $appConfig?.ai_provider && ($appConfig?.ai_api_key || $appConfig?.openai_api_key)}
{/if}
{/if} {#if tableContextMenu}
e.stopPropagation()}>
Cell Color
{#each cellColors as color} {/each}
{/if} {#if imageToolbar}
(imageToolbar = null)}>
e.stopPropagation()}>
{/if} {#if codeLangDropdown}
e.stopPropagation()}> {#each codeLanguages as lang} {/each}
{/if} {#if slashMenu}
e.stopPropagation()}> {#if slashTablePicker}
{#each Array(8) as _, r} {#each Array(10) as _, c}
slashTableHover = { rows: r + 1, cols: c + 1 }} onmousedown={(e) => { e.preventDefault(); slashInsertTable(r + 1, c + 1); }} >
{/each} {/each}
{slashTableHover.rows > 0 ? `${slashTableHover.rows} x ${slashTableHover.cols}` : 'Select table size'}
{:else if slashFiltered.length === 0}
No matching commands
{:else} {#each slashFiltered as cmd, i} {/each} {/if}
{/if} {#if wikiLinkMenu} {/if} {#if aiMenu}
e.stopPropagation()}> {#if aiResult !== null || aiLoading}
{#if aiLoading} Generating... {:else} AI Result {/if}
{#if aiError}
{aiError}
{:else}
{aiResult}
{/if} {#if !aiLoading && aiResult && !aiError}
{/if} {:else if aiShowCustom}
Custom Prompt
{:else if aiTranslateMenu}
Translate to
{:else if aiEmptyNote}
Generate Note
{:else}
{aiWholeNote ? 'AI Actions (Entire Note)' : 'AI Actions'}
{/if}
{/if} {#if linkModal} {/if} {#if showGraph} showGraph = false} onnavigate={(path, title) => { showGraph = false; navigateToWikiLink(path, title); }} /> {/if}