reiji-h 2 лет назад
Родитель
Сommit
96a17c91de
1 измененных файлов с 2 добавлено и 14 удалено
  1. 2 14
      apps/app/src/components/PageEditor/PageEditor.tsx

+ 2 - 14
apps/app/src/components/PageEditor/PageEditor.tsx

@@ -74,7 +74,6 @@ declare global {
 }
 }
 
 
 // for scrolling
 // for scrolling
-let lastScrolledDateWithCursor: Date | null = null;
 let isOriginOfScrollSyncEditor = false;
 let isOriginOfScrollSyncEditor = false;
 let isOriginOfScrollSyncPreview = false;
 let isOriginOfScrollSyncPreview = false;
 
 
@@ -360,12 +359,6 @@ export const PageEditor = React.memo((props: Props): JSX.Element => {
       return;
       return;
     }
     }
 
 
-    const now = new Date();
-    if (lastScrolledDateWithCursor != null && now.getTime() - lastScrolledDateWithCursor.getTime() < 50) {
-      lastScrolledDateWithCursor = now;
-      return;
-    }
-
     if (isOriginOfScrollSyncPreview) {
     if (isOriginOfScrollSyncPreview) {
       isOriginOfScrollSyncPreview = false;
       isOriginOfScrollSyncPreview = false;
       return;
       return;
@@ -382,11 +375,6 @@ export const PageEditor = React.memo((props: Props): JSX.Element => {
       return;
       return;
     }
     }
 
 
-    const now = new Date();
-    if (lastScrolledDateWithCursor != null && now.getTime() - lastScrolledDateWithCursor.getTime() < 50) {
-      lastScrolledDateWithCursor = now;
-      return;
-    }
     if (isOriginOfScrollSyncEditor) {
     if (isOriginOfScrollSyncEditor) {
       isOriginOfScrollSyncEditor = false;
       isOriginOfScrollSyncEditor = false;
       return;
       return;
@@ -396,7 +384,7 @@ export const PageEditor = React.memo((props: Props): JSX.Element => {
     scrollPreview(codeMirrorEditor.view.scrollDOM, previewRef.current);
     scrollPreview(codeMirrorEditor.view.scrollDOM, previewRef.current);
   }, [codeMirrorEditor, previewRef]);
   }, [codeMirrorEditor, previewRef]);
 
 
-  const scrollPreviewHandlerThrottle = useMemo(() => throttle(150, scrollPreviewHandler), [scrollPreviewHandler]);
+  const scrollPreviewHandlerThrottle = useMemo(() => throttle(25, scrollPreviewHandler), [scrollPreviewHandler]);
 
 
   const afterResolvedHandler = useCallback(async() => {
   const afterResolvedHandler = useCallback(async() => {
     // get page data from db
     // get page data from db
@@ -521,7 +509,7 @@ export const PageEditor = React.memo((props: Props): JSX.Element => {
             markdown={markdownToPreview}
             markdown={markdownToPreview}
             pagePath={currentPagePath}
             pagePath={currentPagePath}
             expandContentWidth={shouldExpandContent}
             expandContentWidth={shouldExpandContent}
-            pastEnd={previewRef.current?.getBoundingClientRect().height}
+            pastEnd={previewRef?.current?.getBoundingClientRect().height ?? 200 - 200}
           />
           />
         </div>
         </div>
         {/*
         {/*