From b56bb8ffc05c32018e3cd9876344fa4aad10bee9 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Thu, 18 Aug 2022 18:03:19 +0800 Subject: [PATCH] :bug: fix https://github.com/siyuan-note/siyuan/issues/5671 --- app/src/protyle/scroll/saveScroll.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/app/src/protyle/scroll/saveScroll.ts b/app/src/protyle/scroll/saveScroll.ts index 471844d74..42ff6cf5a 100644 --- a/app/src/protyle/scroll/saveScroll.ts +++ b/app/src/protyle/scroll/saveScroll.ts @@ -63,10 +63,14 @@ export const restoreScroll = (protyle: IProtyle, scrollAttr: IScrollAttr) => { /// #endif } } else if (scrollAttr.zoomInId && protyle.block.id !== scrollAttr.zoomInId) { - zoomOut(protyle, scrollAttr.zoomInId, undefined, true, () => { - protyle.contentElement.scrollTop = scrollAttr.scrollTop; - if (scrollAttr.focusId) { - focusByOffset(protyle.wysiwyg.element.querySelector(`[data-node-id="${scrollAttr.focusId}"]`), scrollAttr.focusStart, scrollAttr.focusEnd); + fetchPost("/api/block/checkBlockExist", {id: scrollAttr.zoomInId}, existResponse => { + if (existResponse.data) { + zoomOut(protyle, scrollAttr.zoomInId, undefined, true, () => { + protyle.contentElement.scrollTop = scrollAttr.scrollTop; + if (scrollAttr.focusId) { + focusByOffset(protyle.wysiwyg.element.querySelector(`[data-node-id="${scrollAttr.focusId}"]`), scrollAttr.focusStart, scrollAttr.focusEnd); + } + }); } }); } else if (!protyle.scroll.element.classList.contains("fn__none")) {