From 9b14fe7bdb054c3c260ed9f07e321001fb313b5e Mon Sep 17 00:00:00 2001 From: V Date: Fri, 24 May 2024 10:10:49 +0800 Subject: [PATCH] :art: https://github.com/siyuan-note/siyuan/issues/11517 --- app/src/dialog/processSystem.ts | 2 +- app/src/protyle/scroll/saveScroll.ts | 12 ++++++++---- app/src/protyle/util/reload.ts | 5 +++-- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/app/src/dialog/processSystem.ts b/app/src/dialog/processSystem.ts index 511c484b95b..99eb9706879 100644 --- a/app/src/dialog/processSystem.ts +++ b/app/src/dialog/processSystem.ts @@ -71,7 +71,7 @@ export const reloadSync = (app: App, data: { upsertRootIDs: string[], removeRoot id: item.editor.protyle.block.rootID, }, (response) => { item.editor.protyle.wysiwyg.renderCustom(response.data.ial); - reloadProtyle(item.editor.protyle, false); + reloadProtyle(item.editor.protyle, false, true); updateTitle(item.editor.protyle.block.rootID, item.parent, item.editor.protyle); }); } else if (data.removeRootIDs.includes(item.editor.protyle.block.rootID)) { diff --git a/app/src/protyle/scroll/saveScroll.ts b/app/src/protyle/scroll/saveScroll.ts index 133898762f5..48dc2803a96 100644 --- a/app/src/protyle/scroll/saveScroll.ts +++ b/app/src/protyle/scroll/saveScroll.ts @@ -48,7 +48,8 @@ export const getDocByScroll = (options: { scrollAttr: IScrollAttr, mergedOptions?: IOptions, cb?: () => void - focus?: boolean + focus?: boolean, + updateReadonly?: boolean }) => { let actions: string[] = []; if (options.mergedOptions) { @@ -80,7 +81,8 @@ export const getDocByScroll = (options: { protyle: options.protyle, action: actions, scrollAttr: options.scrollAttr, - afterCB: options.cb + afterCB: options.cb, + updateReadonly: options.updateReadonly }); }); } else { @@ -90,7 +92,8 @@ export const getDocByScroll = (options: { protyle: options.protyle, action: actions, scrollAttr: options.scrollAttr, - afterCB: options.cb + afterCB: options.cb, + updateReadonly: options.updateReadonly }); } }); @@ -109,7 +112,8 @@ export const getDocByScroll = (options: { protyle: options.protyle, action: actions, scrollAttr: options.scrollAttr, - afterCB: options.cb + afterCB: options.cb, + updateReadonly: options.updateReadonly }); }); }; diff --git a/app/src/protyle/util/reload.ts b/app/src/protyle/util/reload.ts index 8768431d87a..57b46a505c9 100644 --- a/app/src/protyle/util/reload.ts +++ b/app/src/protyle/util/reload.ts @@ -5,7 +5,7 @@ import {renderBacklink} from "../wysiwyg/renderBacklink"; import {hasClosestByClassName} from "./hasClosest"; import {preventScroll} from "../scroll/preventScroll"; -export const reloadProtyle = (protyle: IProtyle, focus: boolean) => { +export const reloadProtyle = (protyle: IProtyle, focus: boolean, updateReadonly?: boolean) => { if (!protyle.preview.element.classList.contains("fn__none")) { protyle.preview.render(protyle); return; @@ -51,7 +51,8 @@ export const reloadProtyle = (protyle: IProtyle, focus: boolean) => { getDocByScroll({ protyle, focus, - scrollAttr: saveScroll(protyle, true) + scrollAttr: saveScroll(protyle, true), + updateReadonly }); } };