Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: fix https://github.com/siyuan-note/siyuan/issues/5237

Vanessa62d66c86380d
diff --git a/app/src/layout/Wnd.ts b/app/src/layout/Wnd.ts
index 88fa3f5f5d..d7ccba5968 100644
--- a/app/src/layout/Wnd.ts
+++ b/app/src/layout/Wnd.ts
@@ -22,6 +22,7 @@ import {Search} from "../search";
import {showMessage} from "../dialog/message";
import {openFileById, updatePanelByEditor} from "../editor/util";
import {scrollCenter} from "../util/highlightById";
+import {getAllModels} from "./getAll";
export class Wnd {
public id: string;
@@ -433,11 +434,6 @@ export class Wnd {
this.children.find((item, index) => {
if (item.id === id) {
if (this.children.length === 1) {
- if (this.children[0].model && this.children[0].model instanceof Editor) {
- // 关闭窗口中的最后一个 tab
- setPanelFocus(this.headersElement.parentElement);
- updatePanelByEditor();
- }
this.destroyModel(this.children[0].model);
this.children = [];
if (["top", "bottom", "left", "right"].includes(this.parent.type)) {
@@ -445,6 +441,13 @@ export class Wnd {
} else {
this.remove();
}
+ getAllModels().editor.forEach(item => {
+ if (!item.element.classList.contains("fn__none")) {
+ setPanelFocus(item.parent.parent.headersElement.parentElement);
+ updatePanelByEditor(item.editor.protyle, true, true);
+ return;
+ }
+ });
return;
}
if (item.headElement) {