mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-22 01:20:12 +01:00
This commit is contained in:
parent
51a0db5822
commit
14a01a7365
2 changed files with 14 additions and 7 deletions
|
|
@ -576,7 +576,7 @@ export class Wnd {
|
||||||
model.send("closews", {});
|
model.send("closews", {});
|
||||||
}
|
}
|
||||||
|
|
||||||
private removeTabAction = (id: string, closeAll = false, hasSaveScroll = true) => {
|
private removeTabAction = (id: string, closeAll = false, hasSaveScroll = true, animate = true) => {
|
||||||
clearCounter();
|
clearCounter();
|
||||||
this.children.find((item, index) => {
|
this.children.find((item, index) => {
|
||||||
if (item.id === id) {
|
if (item.id === id) {
|
||||||
|
|
@ -616,10 +616,14 @@ export class Wnd {
|
||||||
this.switchTab(this.children[currentIndex].headElement, true);
|
this.switchTab(this.children[currentIndex].headElement, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
item.headElement.setAttribute("style", "max-width: 0px;");
|
if (animate) {
|
||||||
setTimeout(() => {
|
item.headElement.setAttribute("style", "max-width: 0px;");
|
||||||
|
setTimeout(() => {
|
||||||
|
item.headElement.remove();
|
||||||
|
}, Constants.TIMEOUT_TRANSITION);
|
||||||
|
} else {
|
||||||
item.headElement.remove();
|
item.headElement.remove();
|
||||||
}, Constants.TIMEOUT_TRANSITION);
|
}
|
||||||
}
|
}
|
||||||
item.panelElement.remove();
|
item.panelElement.remove();
|
||||||
this.destroyModel(item.model);
|
this.destroyModel(item.model);
|
||||||
|
|
@ -643,7 +647,7 @@ export class Wnd {
|
||||||
/// #endif
|
/// #endif
|
||||||
};
|
};
|
||||||
|
|
||||||
public removeTab(id: string, closeAll = false, needSaveScroll = true) {
|
public removeTab(id: string, closeAll = false, needSaveScroll = true, animate = true) {
|
||||||
for (let index = 0; index < this.children.length; index++) {
|
for (let index = 0; index < this.children.length; index++) {
|
||||||
const item = this.children[index];
|
const item = this.children[index];
|
||||||
if (item.id === id) {
|
if (item.id === id) {
|
||||||
|
|
@ -652,9 +656,9 @@ export class Wnd {
|
||||||
showMessage(window.siyuan.languages.uploading);
|
showMessage(window.siyuan.languages.uploading);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.removeTabAction(id, closeAll, needSaveScroll);
|
this.removeTabAction(id, closeAll, needSaveScroll, animate);
|
||||||
} else {
|
} else {
|
||||||
this.removeTabAction(id, closeAll, needSaveScroll);
|
this.removeTabAction(id, closeAll, needSaveScroll, animate);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -228,6 +228,9 @@ const JSONToCenter = (json: any, layout?: Layout | Wnd | Tab | Model) => {
|
||||||
(layout as Wnd).addTab(child);
|
(layout as Wnd).addTab(child);
|
||||||
(layout as Wnd).showHeading();
|
(layout as Wnd).showHeading();
|
||||||
} else if (json.instance === "Editor" && json.blockId) {
|
} else if (json.instance === "Editor" && json.blockId) {
|
||||||
|
if (window.siyuan.config.fileTree.openFilesUseCurrentTab) {
|
||||||
|
(layout as Tab).headElement.classList.add("item--unupdate");
|
||||||
|
}
|
||||||
(layout as Tab).headElement.setAttribute("data-initdata", JSON.stringify(json));
|
(layout as Tab).headElement.setAttribute("data-initdata", JSON.stringify(json));
|
||||||
} else if (json.instance === "Asset") {
|
} else if (json.instance === "Asset") {
|
||||||
(layout as Tab).addModel(new Asset({
|
(layout as Tab).addModel(new Asset({
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue