-
diff --git a/src/components/Editor.css b/src/components/Editor.css
index e82998cd..2652a10c 100644
--- a/src/components/Editor.css
+++ b/src/components/Editor.css
@@ -23,6 +23,24 @@
opacity: 0.55;
}
+/* Breadcrumb bar: title + shadow toggled via data attribute (no React re-render) */
+.breadcrumb-bar {
+ transition: box-shadow 0.2s ease;
+ box-shadow: none;
+}
+
+.breadcrumb-bar[data-title-hidden] {
+ box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
+}
+
+.breadcrumb-bar__title {
+ display: none;
+}
+
+.breadcrumb-bar[data-title-hidden] .breadcrumb-bar__title {
+ display: flex;
+}
+
/* Scroll area wrapping title + editor — single scroll context for alignment */
.editor-scroll-area {
flex: 1;
diff --git a/src/components/EditorContent.tsx b/src/components/EditorContent.tsx
index 8fa39b8a..4373ad46 100644
--- a/src/components/EditorContent.tsx
+++ b/src/components/EditorContent.tsx
@@ -1,5 +1,5 @@
import type React from 'react'
-import { useCallback, useRef, useState, useEffect } from 'react'
+import { useCallback, useRef, useEffect } from 'react'
import type { VaultEntry, NoteStatus } from '../types'
import type { useCreateBlockNote } from '@blocknote/react'
import { DiffView } from './DiffView'
@@ -120,9 +120,9 @@ function bindPath(cb: ((path: string) => void) | undefined, path: string) {
return cb ? () => cb(path) : undefined
}
-function ActiveTabBreadcrumb({ activeTab, titleHidden, props }: {
+function ActiveTabBreadcrumb({ activeTab, barRef, props }: {
activeTab: Tab
- titleHidden: boolean
+ barRef: React.RefObject
props: Omit
}) {
const wordCount = countWords(activeTab.content)
@@ -131,7 +131,7 @@ function ActiveTabBreadcrumb({ activeTab, titleHidden, props }: {
(null)
- const [titleScrolledAway, setTitleScrolledAway] = useState(false)
- const titleHidden = showEditor && titleScrolledAway
+ const breadcrumbBarRef = useRef(null)
useEffect(() => {
const el = titleSectionRef.current
- if (!el) return
+ const bar = breadcrumbBarRef.current
+ if (!el || !bar) return
const observer = new IntersectionObserver(
- ([e]) => setTitleScrolledAway(!e.isIntersecting),
+ ([e]) => {
+ if (e.isIntersecting) bar.removeAttribute('data-title-hidden')
+ else bar.setAttribute('data-title-hidden', '')
+ },
{ threshold: 0 },
)
observer.observe(el)
- return () => observer.disconnect()
+ return () => { observer.disconnect(); bar.removeAttribute('data-title-hidden') }
}, [activeTab?.entry.path, showEditor])
const handleSetIcon = useCallback((emoji: string) => {
@@ -198,7 +201,7 @@ export function EditorContent({
{activeTab && (
)}