diff --git a/app/src/dialog/processSystem.ts b/app/src/dialog/processSystem.ts index 95a9f47c7..1f07b3ff6 100644 --- a/app/src/dialog/processSystem.ts +++ b/app/src/dialog/processSystem.ts @@ -35,7 +35,14 @@ const updateTitle = (rootID: string, tab: Tab, protyle?: IProtyle) => { }); }; -export const reloadSync = (app: App, data: { upsertRootIDs: string[], removeRootIDs: string[] }, hideMsg = true) => { +export const reloadSync = ( + app: App, + data: { upsertRootIDs: string[], removeRootIDs: string[] }, + hideMsg = true, + // 同步的时候需要更新只读状态 https://github.com/siyuan-note/siyuan/issues/11517 + // 调整大纲的时候需要使用现有状态 https://github.com/siyuan-note/siyuan/issues/11808 + updateReadonly = true +) => { if (hideMsg) { hideMessage(); } @@ -44,14 +51,14 @@ export const reloadSync = (app: App, data: { upsertRootIDs: string[], removeRoot if (data.removeRootIDs.includes(window.siyuan.mobile.popEditor.protyle.block.rootID)) { hideElements(["dialog"]); } else { - reloadProtyle(window.siyuan.mobile.popEditor.protyle, false); + reloadProtyle(window.siyuan.mobile.popEditor.protyle, false, updateReadonly); } } if (window.siyuan.mobile.editor) { if (data.removeRootIDs.includes(window.siyuan.mobile.editor.protyle.block.rootID)) { setEmpty(app); } else { - reloadProtyle(window.siyuan.mobile.editor.protyle, false); + reloadProtyle(window.siyuan.mobile.editor.protyle, false, updateReadonly); fetchPost("/api/block/getDocInfo", { id: window.siyuan.mobile.editor.protyle.block.rootID }, (response) => { @@ -71,7 +78,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, true); + reloadProtyle(item.editor.protyle, false, updateReadonly); updateTitle(item.editor.protyle.block.rootID, item.parent, item.editor.protyle); }); } else if (data.removeRootIDs.includes(item.editor.protyle.block.rootID)) { @@ -283,7 +290,7 @@ export const transactionError = () => { }); }; -export const refreshFileTree = (cb?:() => void) => { +export const refreshFileTree = (cb?: () => void) => { window.siyuan.storage[Constants.LOCAL_FILEPOSITION] = {}; setStorageVal(Constants.LOCAL_FILEPOSITION, window.siyuan.storage[Constants.LOCAL_FILEPOSITION]); fetchPost("/api/filetree/refreshFiletree", {}, () => { diff --git a/app/src/index.ts b/app/src/index.ts index 6e13ded84..0bcd88cf5 100644 --- a/app/src/index.ts +++ b/app/src/index.ts @@ -72,7 +72,7 @@ export class App { reloadSync(this, data.data); break; case "reloaddoc": - reloadSync(this, {upsertRootIDs: [data.data], removeRootIDs: []}, false); + reloadSync(this, {upsertRootIDs: [data.data], removeRootIDs: []}, false, false); break; case "readonly": window.siyuan.config.editor.readOnly = data.data; diff --git a/app/src/window/index.ts b/app/src/window/index.ts index c73f24ba8..24a51a7bc 100644 --- a/app/src/window/index.ts +++ b/app/src/window/index.ts @@ -59,6 +59,9 @@ class App { window.siyuan.emojis = response.data as IEmoji[]; }); break; + case "reloaddoc": + reloadSync(this, {upsertRootIDs: [data.data], removeRootIDs: []}, false, false); + break; case "syncMergeResult": reloadSync(this, data.data); break;