From 0707389feec3adf87fd74b39b0b1a8f9b44e088a Mon Sep 17 00:00:00 2001 From: Vanessa Date: Tue, 12 Jul 2022 12:08:26 +0800 Subject: [PATCH] :bug: fix https://github.com/siyuan-note/siyuan/issues/5395 --- app/src/protyle/util/onGet.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/src/protyle/util/onGet.ts b/app/src/protyle/util/onGet.ts index b91bf536e..f6f3f42a0 100644 --- a/app/src/protyle/util/onGet.ts +++ b/app/src/protyle/util/onGet.ts @@ -123,6 +123,8 @@ const setHTML = (options: { content: string, action?: string[] }, protyle: IProt protyle.contentElement.scrollTop = protyle.contentElement.scrollTop + (removeElement.getBoundingClientRect().top - lastRemoveTop); } protyle.wysiwyg.element.insertAdjacentHTML("beforeend", options.content); + // https://github.com/siyuan-note/siyuan/issues/5395 + protyle.scroll.lastScrollTop = 0; } else if (options.action.includes(Constants.CB_GET_BEFORE)) { preventScroll(protyle); const lastElement = protyle.wysiwyg.element.firstElementChild as HTMLElement; @@ -136,6 +138,8 @@ const setHTML = (options: { content: string, action?: string[] }, protyle: IProt protyle.wysiwyg.element.lastElementChild.remove(); } } + // https://github.com/siyuan-note/siyuan/issues/5395 + protyle.scroll.lastScrollTop = 0; } else { protyle.wysiwyg.element.innerHTML = options.content; }