From c894c7d582567df83c2ef1bb522e7ed61457a063 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Wed, 18 Oct 2023 22:53:44 +0800 Subject: [PATCH] :art: fix https://github.com/siyuan-note/siyuan/issues/9450 --- app/src/dialog/processSystem.ts | 2 +- app/src/editor/util.ts | 5 ----- app/src/layout/Wnd.ts | 2 +- app/src/layout/util.ts | 4 ++++ app/src/protyle/util/onGet.ts | 3 --- 5 files changed, 6 insertions(+), 10 deletions(-) diff --git a/app/src/dialog/processSystem.ts b/app/src/dialog/processSystem.ts index 09e93a16f..1681e7ab2 100644 --- a/app/src/dialog/processSystem.ts +++ b/app/src/dialog/processSystem.ts @@ -368,7 +368,7 @@ export const setTitle = (title: string) => { const dragElement = document.getElementById("drag"); const workspaceName = getWorkspaceName(); if (title === window.siyuan.languages.siyuanNote) { - const versionTitle = `${title} - ${workspaceName} - v${Constants.SIYUAN_VERSION}`; + const versionTitle = `${workspaceName} - ${window.siyuan.languages.siyuanNote} v${Constants.SIYUAN_VERSION}`; document.title = versionTitle; if (dragElement) { dragElement.textContent = versionTitle; diff --git a/app/src/editor/util.ts b/app/src/editor/util.ts index 2368bbe60..d9ff6bcaf 100644 --- a/app/src/editor/util.ts +++ b/app/src/editor/util.ts @@ -498,7 +498,6 @@ export const updatePanelByEditor = (options: { reload: boolean, resize: boolean }) => { - let title = window.siyuan.languages.siyuanNote; if (options.protyle && options.protyle.path) { // https://ld246.com/article/1637636106054/comment/1641485541929#comments if (options.protyle.element.classList.contains("fn__none") || @@ -508,9 +507,6 @@ export const updatePanelByEditor = (options: { ) { return; } - if (options.protyle.title) { - title = options.protyle.title.editElement.textContent; - } if (options.resize) { resize(options.protyle); } @@ -543,7 +539,6 @@ export const updatePanelByEditor = (options: { const models = getAllModels(); updateOutline(models, options.protyle, options.reload); updateBacklinkGraph(models, options.protyle); - setTitle(title); }; export const isCurrentEditor = (blockId: string) => { diff --git a/app/src/layout/Wnd.ts b/app/src/layout/Wnd.ts index c53fb1e50..4af5e0b8a 100644 --- a/app/src/layout/Wnd.ts +++ b/app/src/layout/Wnd.ts @@ -402,7 +402,6 @@ export class Wnd { } public switchTab(target: HTMLElement, pushBack = false, update = true, resize = true) { - setPanelFocus(this.headersElement.parentElement.parentElement); let currentTab: Tab; this.children.forEach((item) => { if (target === item.headElement) { @@ -424,6 +423,7 @@ export class Wnd { } } }); + setPanelFocus(this.headersElement.parentElement.parentElement); if (currentTab && currentTab.headElement) { const initData = currentTab.headElement.getAttribute("data-initdata"); if (initData) { diff --git a/app/src/layout/util.ts b/app/src/layout/util.ts index 7f0e0f283..e10d9e384 100644 --- a/app/src/layout/util.ts +++ b/app/src/layout/util.ts @@ -38,8 +38,12 @@ import {newCardModel} from "../card/newCardTab"; import {openRecentDocs} from "../business/openRecentDocs"; import {App} from "../index"; import {afterLoadPlugin} from "../plugin/loader"; +import {setTitle} from "../dialog/processSystem"; export const setPanelFocus = (element: Element) => { + if (element.getAttribute("data-type") === "wnd") { + setTitle(element.querySelector('.layout-tab-bar .item--focus[data-type="tab-header"] .item__text')?.textContent || window.siyuan.languages.siyuanNote); + } if (element.classList.contains("layout__tab--active") || element.classList.contains("layout__wnd--active")) { return; } diff --git a/app/src/protyle/util/onGet.ts b/app/src/protyle/util/onGet.ts index 7cb3fd389..33b90b970 100644 --- a/app/src/protyle/util/onGet.ts +++ b/app/src/protyle/util/onGet.ts @@ -107,9 +107,6 @@ export const onGet = (options: { isSyncing: options.data.data.isSyncing, afterCB: options.afterCB, }, options.protyle); - if (options.protyle.model) { - setTitle(response.data.ial.title); - } removeLoading(options.protyle); }); };