From bb6bad6120b54e7130acf762a94202d770268df9 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Mon, 27 Jun 2022 21:37:58 +0800 Subject: [PATCH] :bug: fix https://github.com/siyuan-note/siyuan/issues/5291 --- app/src/protyle/util/onGet.ts | 1 + app/src/protyle/wysiwyg/index.ts | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/app/src/protyle/util/onGet.ts b/app/src/protyle/util/onGet.ts index 03f2b3f28..1fc72bb10 100644 --- a/app/src/protyle/util/onGet.ts +++ b/app/src/protyle/util/onGet.ts @@ -206,6 +206,7 @@ const setHTML = (options: { content: string, action?: string[] }, protyle: IProt if (!protyle.scroll.element.classList.contains("fn__none") && protyle.wysiwyg.element.lastElementChild.getAttribute("data-eof") !== "true" && protyle.contentElement.scrollHeight > 0 && // 没有激活的页签 https://github.com/siyuan-note/siyuan/issues/5255 + !options.action.includes(Constants.CB_GET_FOCUSFIRST) && protyle.contentElement.scrollHeight <= protyle.contentElement.clientHeight) { fetchPost("/api/filetree/getDoc", { id: protyle.wysiwyg.element.lastElementChild.getAttribute("data-node-id"), diff --git a/app/src/protyle/wysiwyg/index.ts b/app/src/protyle/wysiwyg/index.ts index 405137c74..fa7eab8fb 100644 --- a/app/src/protyle/wysiwyg/index.ts +++ b/app/src/protyle/wysiwyg/index.ts @@ -492,10 +492,11 @@ export class WYSIWYG { } }); - // https://github.com/siyuan-note/siyuan/issues/4099 + let mousewheelTime = 0 this.element.addEventListener("mousewheel", (event: WheelEvent) => { // https://ld246.com/article/1648865235549 - if (event.deltaY < 0 && !protyle.scroll.element.classList.contains("fn__none") && + if (event.timeStamp - mousewheelTime > 6000 && + event.deltaY < 0 && !protyle.scroll.element.classList.contains("fn__none") && protyle.contentElement.clientHeight === protyle.contentElement.scrollHeight && protyle.wysiwyg.element.firstElementChild.getAttribute("data-eof") !== "true") { fetchPost("/api/filetree/getDoc", { @@ -506,10 +507,13 @@ export class WYSIWYG { }, getResponse => { onGet(getResponse, protyle, [Constants.CB_GET_BEFORE, Constants.CB_GET_UNCHANGEID]); }); + mousewheelTime = 0; } + mousewheelTime = event.timeStamp; if (event.deltaX === 0) { return; } + // https://github.com/siyuan-note/siyuan/issues/4099 const tableElement = hasClosestByClassName(event.target as HTMLElement, "table"); if (tableElement) { const tableSelectElement = tableElement.querySelector(".table__select") as HTMLElement;