mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-24 02:20:13 +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) {
|
if (this.parent.type === "center" && this.children.length === 2 && !this.children[0].headElement) {
|
||||||
this.removeTab(this.children[0].id);
|
this.removeTab(this.children[0].id);
|
||||||
} else if (this.children.length > window.siyuan.config.fileTree.maxOpenTabCount) {
|
} 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 removeId: string;
|
||||||
let openTime: string;
|
let openTime: string;
|
||||||
this.children.forEach((item, index) => {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
if (!openTime) {
|
if (!openTime) {
|
||||||
|
|
@ -448,7 +462,6 @@ export class Wnd {
|
||||||
this.removeTab(removeId);
|
this.removeTab(removeId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private destroyModel(model: Model) {
|
private destroyModel(model: Model) {
|
||||||
if (!model) {
|
if (!model) {
|
||||||
|
|
@ -518,12 +531,15 @@ export class Wnd {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
// 初始化移除窗口,但 centerLayout 还没有赋值 https://ld246.com/article/1658718634416
|
||||||
|
if (window.siyuan.layout.centerLayout) {
|
||||||
const wnd = getWndByLayout(window.siyuan.layout.centerLayout);
|
const wnd = getWndByLayout(window.siyuan.layout.centerLayout);
|
||||||
if (!wnd) {
|
if (!wnd) {
|
||||||
const wnd = new Wnd();
|
const wnd = new Wnd();
|
||||||
window.siyuan.layout.centerLayout.addWnd(wnd);
|
window.siyuan.layout.centerLayout.addWnd(wnd);
|
||||||
wnd.addTab(newCenterEmptyTab());
|
wnd.addTab(newCenterEmptyTab());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
/// #if !BROWSER
|
/// #if !BROWSER
|
||||||
webFrame.clearCache();
|
webFrame.clearCache();
|
||||||
getCurrentWindow().webContents.session.clearCache();
|
getCurrentWindow().webContents.session.clearCache();
|
||||||
|
|
@ -565,6 +581,9 @@ export class Wnd {
|
||||||
} else {
|
} else {
|
||||||
this.children.push(tab);
|
this.children.push(tab);
|
||||||
}
|
}
|
||||||
|
if (this.children.length > window.siyuan.config.fileTree.maxOpenTabCount) {
|
||||||
|
this.removeOverCounter();
|
||||||
|
}
|
||||||
this.switchTab(tab.headElement);
|
this.switchTab(tab.headElement);
|
||||||
|
|
||||||
const oldWnd = tab.parent;
|
const oldWnd = tab.parent;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue