diff --git a/Journal.App/src/lib/components/EditorPanel.svelte b/Journal.App/src/lib/components/EditorPanel.svelte index f1c918e..7cc3aa8 100644 --- a/Journal.App/src/lib/components/EditorPanel.svelte +++ b/Journal.App/src/lib/components/EditorPanel.svelte @@ -9,12 +9,32 @@ export let openDocumentName = "Daily Notes"; export let openDocumentContent = ""; export let onDocumentContentChange: (content: string) => void = () => {}; - export let onOpenDocument: (doc: { id: string; label: string; initialContent: string }) => void = () => {}; + export let onOpenDocument: (doc: { + id: string; + label: string; + initialContent: string; + linkedFrom?: { + id: string; + label: string; + initialContent: string; + section: "entries" | "fragments" | "todos" | "lists" | "calendar"; + }; + }) => void = () => {}; export let onDeleteDocument: (id: string) => void = () => {}; + export let showLinkedBackButton = false; + export let onLinkedBack: () => void = () => {}; export let previewOnly = true;
+ {#if showLinkedBackButton} +
+ +
+ {/if} + {#if !openDocumentId}
edit_note @@ -50,6 +70,7 @@ {openDocumentName} {openDocumentContent} {onDocumentContentChange} + {onOpenDocument} {previewOnly} /> {/if} @@ -66,6 +87,30 @@ overflow: hidden; } + .editor-nav { + display: flex; + align-items: center; + justify-content: flex-start; + } + + .back-btn { + display: inline-flex; + align-items: center; + justify-content: center; + width: 34px; + height: 34px; + border-radius: 8px; + border: 1px solid var(--border-soft); + background: color-mix(in srgb, var(--surface-1) 90%, var(--bg-editor) 10%); + color: var(--text-primary); + padding: 0; + cursor: pointer; + } + + .back-btn:hover { + background: var(--bg-hover); + } + .editor-empty { flex: 1; display: flex; diff --git a/Journal.App/src/lib/components/editor/MarkdownEditor.svelte b/Journal.App/src/lib/components/editor/MarkdownEditor.svelte index 55d9717..10b9336 100644 --- a/Journal.App/src/lib/components/editor/MarkdownEditor.svelte +++ b/Journal.App/src/lib/components/editor/MarkdownEditor.svelte @@ -1,15 +1,32 @@ @@ -260,8 +396,14 @@ {templatesBusy} {templateOptions} {listMode} + fragmentOptions={fragmentAttachmentOptions} + listOptions={listAttachmentOptions} + todoOptions={todoAttachmentOptions} onApplyHeading={applyHeading} onApplyTemplate={(filePath) => void applyTemplateByPath(filePath)} + onAttachFragment={(option) => attachReference("Fragment", option)} + onAttachList={(option) => attachReference("List", option)} + onAttachTodo={(option) => attachReference("To-Do", option)} onBold={() => applyWrap("**")} onItalic={() => applyWrap("*")} onLink={insertLink} @@ -276,7 +418,7 @@
{#if previewOnly} -
+
{@html renderedHtml}
{:else} diff --git a/Journal.App/src/lib/components/editor/MarkdownToolbar.svelte b/Journal.App/src/lib/components/editor/MarkdownToolbar.svelte index ba4360e..a45e300 100644 --- a/Journal.App/src/lib/components/editor/MarkdownToolbar.svelte +++ b/Journal.App/src/lib/components/editor/MarkdownToolbar.svelte @@ -1,13 +1,20 @@