From 5bbc34f2fd0a95216ada8d89ddfde582ad953e14 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Thu, 21 Dec 2023 09:07:33 +0800 Subject: [PATCH] :art: sync rename title --- app/src/dialog/processSystem.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/src/dialog/processSystem.ts b/app/src/dialog/processSystem.ts index 4f44f8ba4..c57fb2caa 100644 --- a/app/src/dialog/processSystem.ts +++ b/app/src/dialog/processSystem.ts @@ -24,11 +24,14 @@ import {saveScroll} from "../protyle/scroll/saveScroll"; import {isInAndroid, isInIOS, setStorageVal} from "../protyle/util/compatibility"; import {Plugin} from "../plugin"; -const updateTitle = (rootID: string, tab: Tab) => { +const updateTitle = (rootID: string, tab: Tab, protyle?: IProtyle) => { fetchPost("/api/block/getDocInfo", { id: rootID }, (response) => { tab.updateTitle(response.data.name); + if (protyle && protyle.title) { + protyle.title.setTitle(response.data.name); + } }); }; @@ -63,7 +66,7 @@ export const reloadSync = (app: App, data: { upsertRootIDs: string[], removeRoot allModels.editor.forEach(item => { if (data.upsertRootIDs.includes(item.editor.protyle.block.rootID)) { reloadProtyle(item.editor.protyle, false); - updateTitle(item.editor.protyle.block.rootID, item.parent); + updateTitle(item.editor.protyle.block.rootID, item.parent, item.editor.protyle); } else if (data.removeRootIDs.includes(item.editor.protyle.block.rootID)) { item.parent.parent.removeTab(item.parent.id, false, false); delete window.siyuan.storage[Constants.LOCAL_FILEPOSITION][item.editor.protyle.block.rootID];