mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-23 18:10:12 +01:00
This commit is contained in:
parent
aafb8b438b
commit
d4af0d0342
1 changed files with 20 additions and 0 deletions
|
|
@ -404,6 +404,8 @@ export class Wnd {
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
tab.headElement.setAttribute("data-opentime", (new Date()).getTime().toString());
|
||||||
}
|
}
|
||||||
const containerElement = this.element.querySelector(".layout-tab-container");
|
const containerElement = this.element.querySelector(".layout-tab-container");
|
||||||
if (!containerElement.querySelector(".fn__flex-1")) {
|
if (!containerElement.querySelector(".fn__flex-1")) {
|
||||||
|
|
@ -423,6 +425,24 @@ export class Wnd {
|
||||||
// 移除 centerLayout 中的 empty
|
// 移除 centerLayout 中的 empty
|
||||||
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 > 5) { // TODO: 需从后台设置中获取
|
||||||
|
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) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!openTime) {
|
||||||
|
openTime = item.headElement.getAttribute("data-opentime")
|
||||||
|
removeId = this.children[index].id
|
||||||
|
} else if (item.headElement.getAttribute("data-opentime") < openTime) {
|
||||||
|
openTime = item.headElement.getAttribute("data-opentime")
|
||||||
|
removeId = this.children[index].id
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (removeId) {
|
||||||
|
this.removeTab(removeId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue