Vanessa 2024-09-26 10:59:45 +08:00
parent d586a26cba
commit 03b00a6b8d
4 changed files with 13 additions and 7 deletions

View file

@ -43,7 +43,8 @@ export const reloadSync = (
hideMsg = true,
// 同步的时候需要更新只读状态 https://github.com/siyuan-note/siyuan/issues/11517
// 调整大纲的时候需要使用现有状态 https://github.com/siyuan-note/siyuan/issues/11808
updateReadonly = true
updateReadonly = true,
onlyUpdateDoc = false
) => {
if (hideMsg) {
hideMessage();
@ -124,11 +125,13 @@ export const reloadSync = (
}
}
});
allModels.files.forEach(item => {
setNoteBook(() => {
item.init(false);
if (onlyUpdateDoc) {
allModels.files.forEach(item => {
setNoteBook(() => {
item.init(false);
});
});
});
}
allModels.bookmark.forEach(item => {
item.update();
});

View file

@ -77,7 +77,7 @@ export class App {
reloadSync(this, data.data);
break;
case "reloaddoc":
reloadSync(this, {upsertRootIDs: [data.data], removeRootIDs: []}, false, false);
reloadSync(this, {upsertRootIDs: [data.data], removeRootIDs: []}, false, false, true);
break;
case "readonly":
window.siyuan.config.editor.readOnly = data.data;

View file

@ -31,6 +31,9 @@ export const onMessage = (app: App, data: IWebSocketData) => {
case "setConf":
window.siyuan.config = data.data;
break;
case "reloaddoc":
reloadSync(this, {upsertRootIDs: [data.data], removeRootIDs: []}, false, false, true);
break;
case "readonly":
window.siyuan.config.editor.readOnly = data.data;
break;

View file

@ -63,7 +63,7 @@ class App {
reloadEmoji();
break;
case "reloaddoc":
reloadSync(this, {upsertRootIDs: [data.data], removeRootIDs: []}, false, false);
reloadSync(this, {upsertRootIDs: [data.data], removeRootIDs: []}, false, false, true);
break;
case "syncMergeResult":
reloadSync(this, data.data);