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/9586

Vanessac0266ffeb4be
diff --git a/app/src/layout/Wnd.ts b/app/src/layout/Wnd.ts
index 62f34cb572..30eeeb3499 100644
--- a/app/src/layout/Wnd.ts
+++ b/app/src/layout/Wnd.ts
@@ -874,6 +874,9 @@ export class Wnd {
}
tab.parent = this;
hideAllElements(["toolbar"]);
+ /// #if !BROWSER
+ setTabPosition();
+ /// #endif
}
public split(direction: TDirection) {
diff --git a/app/src/layout/getAll.ts b/app/src/layout/getAll.ts
index 2872d55378..b110bacbed 100644
--- a/app/src/layout/getAll.ts
+++ b/app/src/layout/getAll.ts
@@ -11,6 +11,7 @@ import {Bookmark} from "./dock/Bookmark";
import {Tag} from "./dock/Tag";
import {Custom} from "./dock/Custom";
import {Protyle} from "../protyle";
+import {Wnd} from "./Wnd";
export const getAllEditor = () => {
const models = getAllModels();
@@ -96,6 +97,17 @@ export const getAllModels = () => {
return models;
};
+export const getAllWnds = (layout: Layout, wnds: Wnd[]) => {
+ for (let i = 0; i < layout.children.length; i++) {
+ const item = layout.children[i];
+ if (item instanceof Wnd) {
+ wnds.push(item);
+ } else if (item instanceof Layout) {
+ getAllWnds(item, wnds);
+ }
+ }
+};
+
export const getAllTabs = () => {
const tabs: Tab[] = [];
const getTabs = (layout: Layout) => {
diff --git a/app/src/menus/tab.ts b/app/src/menus/tab.ts
index cc80f1bb62..29ce0ddc04 100644
--- a/app/src/menus/tab.ts
+++ b/app/src/menus/tab.ts
@@ -9,6 +9,7 @@ import {copySubMenu} from "./commonMenuItem";
import {App} from "../index";
import {Layout} from "../layout";
import {Wnd} from "../layout/Wnd";
+import {getAllWnds} from "../layout/getAll";
const closeMenu = (tab: Tab) => {
const unmodifiedTabs: Tab[] = [];
@@ -130,7 +131,9 @@ const splitSubMenu = (app: App, tab: Tab) => {
}
});
}
- if (tab.parent.parent.children.length > 1) {
+ const wndsTemp: Wnd[] = [];
+ getAllWnds(window.siyuan.layout.layout, wndsTemp);
+ if (wndsTemp.length > 1) {
subMenus.push({
label: window.siyuan.languages.unsplit,
click: () => {
diff --git a/app/src/window/setHeader.ts b/app/src/window/setHeader.ts
index cebde8fb8e..65f08d5299 100644
--- a/app/src/window/setHeader.ts
+++ b/app/src/window/setHeader.ts
@@ -1,23 +1,11 @@
import {isWindow} from "../util/functions";
import {Wnd} from "../layout/Wnd";
-import {Layout} from "../layout";
-import {getAllTabs} from "../layout/getAll";
+import {getAllTabs, getAllWnds} from "../layout/getAll";
import {Editor} from "../editor";
import {Asset} from "../asset";
import {Constants} from "../constants";
import { ipcRenderer } from "electron";
-const getAllWnds = (layout: Layout, wnds: Wnd[]) => {
- for (let i = 0; i < layout.children.length; i++) {
- const item = layout.children[i];
- if (item instanceof Wnd) {
- wnds.push(item);
- } else if (item instanceof Layout) {
- getAllWnds(item, wnds);
- }
- }
-};
-
export const setTabPosition = () => {
if (!isWindow()) {
return;