mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-23 18:10:12 +01:00
This commit is contained in:
parent
2476cb4ccd
commit
fa30244e3e
1 changed files with 37 additions and 18 deletions
|
|
@ -430,10 +430,24 @@ export class Wnd {
|
|||
if (this.parent.type === "center" && this.children.length === 2 && !this.children[0].headElement) {
|
||||
this.removeTab(this.children[0].id);
|
||||
} else if (this.children.length > window.siyuan.config.fileTree.maxOpenTabCount) {
|
||||
this.removeOverCounter(oldFocusIndex);
|
||||
}
|
||||
}
|
||||
|
||||
private removeOverCounter(oldFocusIndex?: number) {
|
||||
if (typeof oldFocusIndex === "undefined") {
|
||||
this.children.forEach((item, index) => {
|
||||
if (item.headElement && item.headElement.classList.contains("item--focus")) {
|
||||
oldFocusIndex = index;
|
||||
}
|
||||
});
|
||||
}
|
||||
let removeId: string;
|
||||
let openTime: string;
|
||||
this.children.forEach((item, index) => {
|
||||
if (item.headElement.classList.contains("item--pin") || item.headElement.classList.contains("item--focus") || index === oldFocusIndex) {
|
||||
if (item.headElement.classList.contains("item--pin") ||
|
||||
item.headElement.classList.contains("item--focus") ||
|
||||
index === oldFocusIndex) {
|
||||
return;
|
||||
}
|
||||
if (!openTime) {
|
||||
|
|
@ -448,7 +462,6 @@ export class Wnd {
|
|||
this.removeTab(removeId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private destroyModel(model: Model) {
|
||||
if (!model) {
|
||||
|
|
@ -518,12 +531,15 @@ export class Wnd {
|
|||
return true;
|
||||
}
|
||||
});
|
||||
// 初始化移除窗口,但 centerLayout 还没有赋值 https://ld246.com/article/1658718634416
|
||||
if (window.siyuan.layout.centerLayout) {
|
||||
const wnd = getWndByLayout(window.siyuan.layout.centerLayout);
|
||||
if (!wnd) {
|
||||
const wnd = new Wnd();
|
||||
window.siyuan.layout.centerLayout.addWnd(wnd);
|
||||
wnd.addTab(newCenterEmptyTab());
|
||||
}
|
||||
}
|
||||
/// #if !BROWSER
|
||||
webFrame.clearCache();
|
||||
getCurrentWindow().webContents.session.clearCache();
|
||||
|
|
@ -565,6 +581,9 @@ export class Wnd {
|
|||
} else {
|
||||
this.children.push(tab);
|
||||
}
|
||||
if (this.children.length > window.siyuan.config.fileTree.maxOpenTabCount) {
|
||||
this.removeOverCounter();
|
||||
}
|
||||
this.switchTab(tab.headElement);
|
||||
|
||||
const oldWnd = tab.parent;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue