Skip to content

Commit

Permalink
🐛 #11931
Browse files Browse the repository at this point in the history
  • Loading branch information
Vanessa219 committed Oct 17, 2024
1 parent da64370 commit dcfb6d7
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions app/src/layout/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import {setTitle} from "../dialog/processSystem";
import {newCenterEmptyTab, resizeTabs} from "./tabUtil";
import {setStorageVal} from "../protyle/util/compatibility";

export const setPanelFocus = (element: Element) => {
export const setPanelFocus = (element: Element, isSaveLayout = true) => {
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);
}
Expand All @@ -54,7 +54,9 @@ export const setPanelFocus = (element: Element) => {
if (element.getAttribute("data-type") === "wnd") {
element.classList.add("layout__wnd--active");
element.querySelector(".layout-tab-bar .item--focus")?.setAttribute("data-activetime", (new Date()).getTime().toString());
saveLayout();
if (isSaveLayout) {
saveLayout();
}
} else {
element.classList.add("layout__tab--active");
Array.from(element.classList).find(item => {
Expand Down Expand Up @@ -506,7 +508,7 @@ export const JSONToLayout = (app: App, isStart: boolean) => {
tab.parent.switchTab(item, false, false, true, false);
});
if (latestTabHeaderElement) {
setPanelFocus(latestTabHeaderElement.parentElement.parentElement.parentElement);
setPanelFocus(latestTabHeaderElement.parentElement.parentElement.parentElement, false);
}
}
// 需放在 tab.parent.switchTab 后,否则当前 tab 永远为最后一个
Expand Down

0 comments on commit dcfb6d7

Please sign in to comment.