From 72752f441ae308fac6a0e928c47e6fc087bfea61 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Wed, 22 Nov 2023 16:47:41 +0800 Subject: [PATCH] :art: fix https://github.com/siyuan-note/siyuan/issues/9695 --- app/src/dialog/processSystem.ts | 1 + app/src/mobile/util/MobileBackFoward.ts | 2 ++ app/src/mobile/util/initFramework.ts | 2 ++ app/src/mobile/util/setEmpty.ts | 6 +++++- 4 files changed, 10 insertions(+), 1 deletion(-) diff --git a/app/src/dialog/processSystem.ts b/app/src/dialog/processSystem.ts index 58ed0f1f1..2eb81dd35 100644 --- a/app/src/dialog/processSystem.ts +++ b/app/src/dialog/processSystem.ts @@ -49,6 +49,7 @@ export const reloadSync = (app: App, data: { upsertRootIDs: string[], removeRoot fetchPost("/api/block/getDocInfo", { id: window.siyuan.mobile.editor.protyle.block.rootID }, (response) => { + setTitle(response.data.name); (document.getElementById("toolbarName") as HTMLInputElement).value = response.data.name === "Untitled" ? "" : response.data.name; }); } diff --git a/app/src/mobile/util/MobileBackFoward.ts b/app/src/mobile/util/MobileBackFoward.ts index 5d63f9a25..b5768d875 100644 --- a/app/src/mobile/util/MobileBackFoward.ts +++ b/app/src/mobile/util/MobileBackFoward.ts @@ -12,6 +12,7 @@ import {closePanel} from "./closePanel"; import {showMessage} from "../../dialog/message"; import {getCurrentEditor} from "../editor"; import {avRender} from "../../protyle/render/av/render"; +import {setTitle} from "../../dialog/processSystem"; const forwardStack: IBackStack[] = []; @@ -42,6 +43,7 @@ const focusStack = (backStack: IBackStack) => { fetchPost("/api/block/getDocInfo", { id: backStack.id, }, (response) => { + setTitle(response.data.name); (document.getElementById("toolbarName") as HTMLInputElement).value = response.data.name === "Untitled" ? "" : response.data.name; protyle.background.render(response.data.ial, protyle.block.rootID); protyle.wysiwyg.renderCustom(response.data.ial); diff --git a/app/src/mobile/util/initFramework.ts b/app/src/mobile/util/initFramework.ts index 05320a4f6..0abd376de 100644 --- a/app/src/mobile/util/initFramework.ts +++ b/app/src/mobile/util/initFramework.ts @@ -19,6 +19,7 @@ import {activeBlur, hideKeyboardToolbar, initKeyboardToolbar} from "./keyboardTo import {syncGuide} from "../../sync/syncGuide"; import {Inbox} from "../../layout/dock/Inbox"; import {App} from "../../index"; +import {setTitle} from "../../dialog/processSystem"; export const initFramework = (app: App, isStart: boolean) => { setInlineStyle(); @@ -162,5 +163,6 @@ const initEditorName = () => { path: window.siyuan.mobile.editor.protyle.path, title: inputElement.value, }); + setTitle(inputElement.value); }); }; diff --git a/app/src/mobile/util/setEmpty.ts b/app/src/mobile/util/setEmpty.ts index 942a478b6..564819fd2 100644 --- a/app/src/mobile/util/setEmpty.ts +++ b/app/src/mobile/util/setEmpty.ts @@ -5,8 +5,10 @@ import {popSearch} from "../menu/search"; import {getRecentDocs} from "../menu/getRecentDocs"; import {openHistory} from "../../history/history"; import {App} from "../../index"; +import {setTitle} from "../../dialog/processSystem"; export const setEmpty = (app: App) => { + setTitle(window.siyuan.languages.siyuanNote); document.getElementById("toolbarName").classList.add("fn__hidden"); document.getElementById("editor").classList.add("fn__none"); const emptyElement = document.getElementById("empty"); @@ -75,7 +77,9 @@ export const setEmpty = (app: App) => { }; export const setEditor = () => { - document.getElementById("toolbarName").classList.remove("fn__hidden"); + const toolbarNameElement = document.getElementById("toolbarName") as HTMLInputElement + setTitle(toolbarNameElement.value); + toolbarNameElement.classList.remove("fn__hidden"); document.getElementById("editor").classList.remove("fn__none"); document.getElementById("empty").classList.add("fn__none"); };