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 dragElement = document.getElementById("drag");
const workspaceName = getWorkspaceName(); const workspaceName = getWorkspaceName();
if (title === window.siyuan.languages.siyuanNote) { 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; document.title = versionTitle;
if (dragElement) { if (dragElement) {
dragElement.textContent = versionTitle; dragElement.textContent = versionTitle;

View File

@ -498,7 +498,6 @@ export const updatePanelByEditor = (options: {
reload: boolean, reload: boolean,
resize: boolean resize: boolean
}) => { }) => {
let title = window.siyuan.languages.siyuanNote;
if (options.protyle && options.protyle.path) { if (options.protyle && options.protyle.path) {
// https://ld246.com/article/1637636106054/comment/1641485541929#comments // https://ld246.com/article/1637636106054/comment/1641485541929#comments
if (options.protyle.element.classList.contains("fn__none") || if (options.protyle.element.classList.contains("fn__none") ||
@ -508,9 +507,6 @@ export const updatePanelByEditor = (options: {
) { ) {
return; return;
} }
if (options.protyle.title) {
title = options.protyle.title.editElement.textContent;
}
if (options.resize) { if (options.resize) {
resize(options.protyle); resize(options.protyle);
} }
@ -543,7 +539,6 @@ export const updatePanelByEditor = (options: {
const models = getAllModels(); const models = getAllModels();
updateOutline(models, options.protyle, options.reload); updateOutline(models, options.protyle, options.reload);
updateBacklinkGraph(models, options.protyle); updateBacklinkGraph(models, options.protyle);
setTitle(title);
}; };
export const isCurrentEditor = (blockId: string) => { export const isCurrentEditor = (blockId: string) => {

View File

@ -402,7 +402,6 @@ export class Wnd {
} }
public switchTab(target: HTMLElement, pushBack = false, update = true, resize = true) { public switchTab(target: HTMLElement, pushBack = false, update = true, resize = true) {
setPanelFocus(this.headersElement.parentElement.parentElement);
let currentTab: Tab; let currentTab: Tab;
this.children.forEach((item) => { this.children.forEach((item) => {
if (target === item.headElement) { if (target === item.headElement) {
@ -424,6 +423,7 @@ export class Wnd {
} }
} }
}); });
setPanelFocus(this.headersElement.parentElement.parentElement);
if (currentTab && currentTab.headElement) { if (currentTab && currentTab.headElement) {
const initData = currentTab.headElement.getAttribute("data-initdata"); const initData = currentTab.headElement.getAttribute("data-initdata");
if (initData) { if (initData) {

View File

@ -38,8 +38,12 @@ import {newCardModel} from "../card/newCardTab";
import {openRecentDocs} from "../business/openRecentDocs"; import {openRecentDocs} from "../business/openRecentDocs";
import {App} from "../index"; import {App} from "../index";
import {afterLoadPlugin} from "../plugin/loader"; import {afterLoadPlugin} from "../plugin/loader";
import {setTitle} from "../dialog/processSystem";
export const setPanelFocus = (element: Element) => { 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")) { if (element.classList.contains("layout__tab--active") || element.classList.contains("layout__wnd--active")) {
return; return;
} }

View File

@ -107,9 +107,6 @@ export const onGet = (options: {
isSyncing: options.data.data.isSyncing, isSyncing: options.data.data.isSyncing,
afterCB: options.afterCB, afterCB: options.afterCB,
}, options.protyle); }, options.protyle);
if (options.protyle.model) {
setTitle(response.data.ial.title);
}
removeLoading(options.protyle); removeLoading(options.protyle);
}); });
}; };