This commit is contained in:
Vanessa 2023-10-18 22:53:44 +08:00
parent 09e2e622fc
commit c894c7d582
5 changed files with 6 additions and 10 deletions

View File

@ -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;

View File

@ -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) => {

View File

@ -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) {

View File

@ -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;
}

View File

@ -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);
});
};