Bläddra i källkod

:art: fix https://github.com/siyuan-note/siyuan/issues/3614

Vanessa 2 år sedan
förälder
incheckning
c4fe56bbd5
1 ändrade filer med 3 tillägg och 2 borttagningar
  1. 3 2
      app/src/protyle/util/onGet.ts

+ 3 - 2
app/src/protyle/util/onGet.ts

@@ -221,8 +221,9 @@ const setHTML = (options: { content: string, action?: string[], unScroll?: boole
         }
         }
     } else if (options.action.includes(Constants.CB_GET_FOCUSFIRST) && !options.unScroll) {
     } else if (options.action.includes(Constants.CB_GET_FOCUSFIRST) && !options.unScroll) {
         // settimeout 时间需短一点,否则定位后快速滚动无效
         // settimeout 时间需短一点,否则定位后快速滚动无效
-        preventScroll(protyle, 8, 256);
-        protyle.contentElement.scrollTop = 8;
+        const headerHeight = protyle.wysiwyg.element.offsetTop - 16;
+        preventScroll(protyle, headerHeight, 256);
+        protyle.contentElement.scrollTop = headerHeight;
         focusBlock(protyle.wysiwyg.element.firstElementChild);
         focusBlock(protyle.wysiwyg.element.firstElementChild);
         /// #if !MOBILE
         /// #if !MOBILE
         if (!options.action.includes(Constants.CB_GET_UNUNDO)) {
         if (!options.action.includes(Constants.CB_GET_UNUNDO)) {