Skip to content

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

:bug: https://github.com/siyuan-note/siyuan/issues/17499

Vanessab36b9119647e
diff --git a/app/src/layout/Wnd.ts b/app/src/layout/Wnd.ts
index de58802e38..36fbb834a3 100644
--- a/app/src/layout/Wnd.ts
+++ b/app/src/layout/Wnd.ts
@@ -1006,8 +1006,8 @@ export class Wnd {
resize: item.resize,
direction,
});
- this.parent.addLayout(layout, item.id);
- const movedWnd = this.parent.children.splice(index, 1)[0];
+ this.parent.addLayout(layout, item.id, after);
+ const movedWnd = this.parent.children.splice(after ? index : index + 1, 1)[0];
if (movedWnd.resize) {
movedWnd.element.previousElementSibling.remove();
movedWnd.resize = undefined;
diff --git a/app/src/layout/index.ts b/app/src/layout/index.ts
index 0d56f6d9ee..9e019495d2 100644
--- a/app/src/layout/index.ts
+++ b/app/src/layout/index.ts
@@ -42,7 +42,7 @@ export class Layout {
}
}
- addLayout(child: Layout, id?: string) {
+ addLayout(child: Layout, id?: string, after = true) {
if (!id) {
this.children.splice(this.children.length, 0, child);
if (this) {
@@ -51,8 +51,12 @@ export class Layout {
} else {
this.children.find((item, index) => {
if (item.id === id) {
- this.children.splice(index + 1, 0, child);
- item.element.after(child.element);
+ this.children.splice(after ? index + 1 : index, 0, child);
+ if (after) {
+ item.element.after(child.element);
+ } else {
+ item.element.before(child.element);
+ }
return true;
}
});
@@ -62,7 +66,7 @@ export class Layout {
} else {
child.element.style[(this && this.direction === "lr") ? "width" : "height"] = child.size;
}
- addResize(child);
+ addResize(child, after);
child.parent = this;
}