@@ -110,28 +110,31 @@ export function EditorPane({
110110 const [ showHeaderBorder , setShowHeaderBorder ] = useState ( false ) ;
111111 const [ showHeaderTitle , setShowHeaderTitle ] = useState ( false ) ;
112112 const noteTitle = firstLineH1Title ( markdown ) ;
113- const updateHeaderState = useCallback ( ( scrollContainer : HTMLDivElement | null ) => {
114- const scrolled = ( scrollContainer ?. scrollTop ?? 0 ) > 0 ;
115- setShowHeaderBorder ( scrolled ) ;
113+ const updateHeaderState = useCallback (
114+ ( scrollContainer : HTMLDivElement | null ) => {
115+ const scrolled = ( scrollContainer ?. scrollTop ?? 0 ) > 0 ;
116+ setShowHeaderBorder ( scrolled ) ;
116117
117- if ( ! scrollContainer || ! noteId ) {
118- setShowHeaderTitle ( false ) ;
119- return ;
120- }
118+ if ( ! scrollContainer || ! noteId ) {
119+ setShowHeaderTitle ( false ) ;
120+ return ;
121+ }
121122
122- const firstLine = scrollContainer . querySelector (
123- "[data-lexical-editor] > :first-child" ,
124- ) as HTMLElement | null ;
123+ const firstLine = scrollContainer . querySelector (
124+ "[data-lexical-editor] > :first-child" ,
125+ ) as HTMLElement | null ;
125126
126- if ( ! firstLine ) {
127- setShowHeaderTitle ( false ) ;
128- return ;
129- }
127+ if ( ! firstLine ) {
128+ setShowHeaderTitle ( false ) ;
129+ return ;
130+ }
130131
131- const scrollRect = scrollContainer . getBoundingClientRect ( ) ;
132- const firstLineRect = firstLine . getBoundingClientRect ( ) ;
133- setShowHeaderTitle ( firstLineRect . bottom <= scrollRect . top ) ;
134- } , [ noteId ] ) ;
132+ const scrollRect = scrollContainer . getBoundingClientRect ( ) ;
133+ const firstLineRect = firstLine . getBoundingClientRect ( ) ;
134+ setShowHeaderTitle ( firstLineRect . bottom <= scrollRect . top ) ;
135+ } ,
136+ [ noteId ] ,
137+ ) ;
135138
136139 useEffect ( ( ) => {
137140 const scrollContainer = scrollContainerRef . current ;
@@ -306,7 +309,7 @@ export function EditorPane({
306309 < div className = "relative min-h-0 flex-1" >
307310 < div
308311 className = { cn (
309- "min-h-0 h-full overflow-y-scroll overscroll-y-contain" ,
312+ "h-full min-h-0 overflow-y-scroll overscroll-y-contain" ,
310313 ! isReadOnly && "cursor-text" ,
311314 ) }
312315 data-editor-scroll-container
0 commit comments