Browse Source

:bug: fix https://github.com/siyuan-note/siyuan/issues/5630

Vanessa 3 years ago
parent
commit
13ebc39bca
1 changed files with 3 additions and 1 deletions
  1. 3 1
      app/src/protyle/scroll/event.ts

+ 3 - 1
app/src/protyle/scroll/event.ts

@@ -45,8 +45,9 @@ export const scrollEvent = (protyle: IProtyle, element: HTMLElement) => {
         }
         }
         if (protyle.scroll.lastScrollTop - element.scrollTop > 0) {
         if (protyle.scroll.lastScrollTop - element.scrollTop > 0) {
             // up
             // up
-            if (element.scrollTop < element.clientHeight / 2 &&
+            if (element.scrollTop < element.clientHeight &&
                 protyle.wysiwyg.element.firstElementChild.getAttribute("data-eof") !== "true") {
                 protyle.wysiwyg.element.firstElementChild.getAttribute("data-eof") !== "true") {
+                protyle.contentElement.style.overflow = "hidden";
                 protyle.wysiwyg.element.setAttribute("data-top", element.scrollTop.toString());
                 protyle.wysiwyg.element.setAttribute("data-top", element.scrollTop.toString());
                 fetchPost("/api/filetree/getDoc", {
                 fetchPost("/api/filetree/getDoc", {
                     id: protyle.wysiwyg.element.firstElementChild.getAttribute("data-node-id"),
                     id: protyle.wysiwyg.element.firstElementChild.getAttribute("data-node-id"),
@@ -54,6 +55,7 @@ export const scrollEvent = (protyle: IProtyle, element: HTMLElement) => {
                     k: protyle.options.key || "",
                     k: protyle.options.key || "",
                     size: Constants.SIZE_GET,
                     size: Constants.SIZE_GET,
                 }, getResponse => {
                 }, getResponse => {
+                    protyle.contentElement.style.overflow = "";
                     onGet(getResponse, protyle, [Constants.CB_GET_BEFORE, Constants.CB_GET_UNCHANGEID]);
                     onGet(getResponse, protyle, [Constants.CB_GET_BEFORE, Constants.CB_GET_UNCHANGEID]);
                 });
                 });
             }
             }