diff --git a/src/components/EditorContent.tsx b/src/components/EditorContent.tsx index ff1149ce..8358f5a4 100644 --- a/src/components/EditorContent.tsx +++ b/src/components/EditorContent.tsx @@ -183,9 +183,18 @@ export function EditorContent({ const breadcrumbBarRef = useRef(null) useEffect(() => { - const el = titleSectionRef.current const bar = breadcrumbBarRef.current - if (!el || !bar) return + if (!bar) return + + // In raw/diff mode the title section is not rendered, so there is nothing + // for the IntersectionObserver to watch. Force the title visible instead. + if (!showEditor) { + bar.setAttribute('data-title-hidden', '') + return () => { bar.removeAttribute('data-title-hidden') } + } + + const el = titleSectionRef.current + if (!el) return const observer = new IntersectionObserver( ([e]) => { if (e.isIntersecting) bar.removeAttribute('data-title-hidden') @@ -205,66 +214,62 @@ export function EditorContent({ if (activeTab) onRemoveNoteIcon?.(activeTab.entry.path) }, [activeTab, onRemoveNoteIcon]) + if (!activeTab) { + return
+ } + + const path = activeTab.entry.path + return (
- {activeTab && ( - - )} - {activeTab && isTrashed && ( + + {isTrashed && ( breadcrumbProps.onRestoreNote?.(activeTab.entry.path)} - onDeletePermanently={() => onDeleteNote?.(activeTab.entry.path)} + onRestore={() => breadcrumbProps.onRestoreNote?.(path)} + onDeletePermanently={() => onDeleteNote?.(path)} /> )} - {activeTab && isArchived && breadcrumbProps.onUnarchiveNote && ( - breadcrumbProps.onUnarchiveNote!(activeTab.entry.path)} /> + {isArchived && breadcrumbProps.onUnarchiveNote && ( + breadcrumbProps.onUnarchiveNote!(path)} /> )} - {activeTab && isConflicted && ( + {isConflicted && ( onKeepMine?.(activeTab.entry.path)} - onKeepTheirs={() => onKeepTheirs?.(activeTab.entry.path)} + onKeepMine={() => onKeepMine?.(path)} + onKeepTheirs={() => onKeepTheirs?.(path)} /> )} {diffMode && } - {showEditor && activeTab && ( + {showEditor && (
-
- {!emojiIcon && ( -
- +
+ {!emojiIcon && ( +
+ +
+ )} +
+ {emojiIcon && ( + + )} + onTitleChange?.(path, newTitle)} />
- )} -
- {emojiIcon && ( - - )} - onTitleChange?.(activeTab.entry.path, newTitle)} - /> +
-
+
-
)} {isLoadingNewTab && showEditor && }