Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: fix https://github.com/siyuan-note/siyuan/issues/9450

Vanessac894c7d58256
diff --git a/app/src/dialog/processSystem.ts b/app/src/dialog/processSystem.ts
index 09e93a16fa..1681e7ab2a 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 2368bbe60a..d9ff6bcaf8 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 c53fb1e50e..4af5e0b8aa 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 7f0e0f283b..e10d9e384d 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 7cb3fd389c..33b90b970f 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);
});
};