@@ -427,54 +427,15 @@ const DocumentEditor: React.FC<DocumentEditorProps> = ({
427427 } ;
428428 } , [ handleGlobalMouseMove , handleGlobalMouseUp ] ) ;
429429
430- // --- Scroll Synchronization Logic ---
431- const handleEditorScroll = useCallback ( ( scrollInfo : { scrollTop : number ; scrollHeight : number ; clientHeight : number ; } ) => {
432- if ( ! viewMode . startsWith ( 'split-' ) || isSyncing . current || ! previewScrollRef . current ) return ;
433-
434- if ( scrollInfo . scrollHeight <= scrollInfo . clientHeight ) return ;
435-
436- const percentage = scrollInfo . scrollTop / ( scrollInfo . scrollHeight - scrollInfo . clientHeight ) ;
437-
438- const previewEl = previewScrollRef . current ;
439- if ( previewEl . scrollHeight <= previewEl . clientHeight ) return ;
440- const newPreviewScrollTop = percentage * ( previewEl . scrollHeight - previewEl . clientHeight ) ;
441-
442- isSyncing . current = true ;
443- previewEl . scrollTop = newPreviewScrollTop ;
444-
445- if ( syncTimeout . current ) clearTimeout ( syncTimeout . current ) ;
446- syncTimeout . current = window . setTimeout ( ( ) => {
447- isSyncing . current = false ;
448- } , 100 ) ;
449- } , [ viewMode ] ) ;
450-
451- const handlePreviewScroll = useCallback ( ( e : React . UIEvent < HTMLDivElement > ) => {
452- if ( ! viewMode . startsWith ( 'split-' ) || isSyncing . current ) return ;
453-
454- const editorHandle = editorEngine === 'monaco' ? editorRef . current : richTextEditorRef . current ;
455- if ( ! editorHandle ) return ;
456-
457- const previewEl = e . currentTarget ;
458- const { scrollTop, scrollHeight, clientHeight } = previewEl ;
459-
460- if ( scrollHeight <= clientHeight ) return ;
461-
462- const percentage = scrollTop / ( scrollHeight - clientHeight ) ;
463-
464- editorHandle . getScrollInfo ( ) . then ( editorInfo => {
465- if ( ! isSyncing . current && editorInfo . scrollHeight > editorInfo . clientHeight ) {
466- const newEditorScrollTop = percentage * ( editorInfo . scrollHeight - editorInfo . clientHeight ) ;
467-
468- isSyncing . current = true ;
469- editorHandle . setScrollTop ( newEditorScrollTop ) ;
430+ // --- Scroll Synchronization Logic (DISABLED) ---
431+ // Scroll sync between editor and preview is disabled per user request.
432+ const handleEditorScroll = useCallback ( ( _scrollInfo : { scrollTop : number ; scrollHeight : number ; clientHeight : number ; } ) => {
433+ // Scroll sync disabled - panes scroll independently
434+ } , [ ] ) ;
470435
471- if ( syncTimeout . current ) clearTimeout ( syncTimeout . current ) ;
472- syncTimeout . current = window . setTimeout ( ( ) => {
473- isSyncing . current = false ;
474- } , 100 ) ;
475- }
476- } ) ;
477- } , [ viewMode , editorEngine ] ) ;
436+ const handlePreviewScroll = useCallback ( ( _e : React . UIEvent < HTMLDivElement > ) => {
437+ // Scroll sync disabled - panes scroll independently
438+ } , [ ] ) ;
478439
479440
480441
0 commit comments