Skip to content

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

:bug: Avoid circular dependency when removing block panel editors https://github.com/siyuan-note/siyuan/issues/18649

Daniel9bc2641c948f
diff --git a/app/src/block/Panel.ts b/app/src/block/Panel.ts
index 34e48fa2eb..06158d3354 100644
--- a/app/src/block/Panel.ts
+++ b/app/src/block/Panel.ts
@@ -645,14 +645,3 @@ export class BlockPanel {
});
}
}
-
-export const removeBlockPanelEditors = (options: {notebookId?: string, rootIDs?: string[]}) => {
- const removalOptions = {
- notebookId: options.notebookId,
- rootIDs: new Set(options.rootIDs || []),
- };
- if (!removalOptions.notebookId && removalOptions.rootIDs.size === 0) {
- return;
- }
- [...window.siyuan.blockPanels].forEach(item => item.removeEditors(removalOptions));
-};
diff --git a/app/src/block/panelRemoval.ts b/app/src/block/panelRemoval.ts
index 8651a65cc6..ce8377d8ea 100644
--- a/app/src/block/panelRemoval.ts
+++ b/app/src/block/panelRemoval.ts
@@ -32,3 +32,14 @@ export const planBlockPanelRemoval = <T>(items: readonly T[],
});
return {removeItems, unresolvedItems};
};
+
+export const removeBlockPanelEditors = (options: {notebookId?: string, rootIDs?: string[]}) => {
+ const removalOptions = {
+ notebookId: options.notebookId,
+ rootIDs: new Set(options.rootIDs || []),
+ };
+ if (!removalOptions.notebookId && removalOptions.rootIDs.size === 0) {
+ return;
+ }
+ [...window.siyuan.blockPanels].forEach(item => item.removeEditors(removalOptions));
+};
diff --git a/app/src/index.ts b/app/src/index.ts
index 792c54bb1e..2492119b8e 100644
--- a/app/src/index.ts
+++ b/app/src/index.ts
@@ -53,7 +53,7 @@ import {reloadSync} from "./util/reloadSync";
import {setTitle} from "./util/processTitle";
import {ensureUILayout} from "./util/ensureUILayout";
import {applyEntryVisibility} from "./config/entryVisibility/runtime";
-import {removeBlockPanelEditors} from "./block/Panel";
+import {removeBlockPanelEditors} from "./block/panelRemoval";
export class App {
public plugins: import("./plugin").Plugin[] = [];
diff --git a/app/src/util/reloadSync.ts b/app/src/util/reloadSync.ts
index 36337acf49..64d8a71e3f 100644
--- a/app/src/util/reloadSync.ts
+++ b/app/src/util/reloadSync.ts
@@ -10,7 +10,7 @@ import {setStorageVal} from "../protyle/util/compatibility";
import type {Tab} from "../layout/Tab";
import {setTitle} from "./processTitle";
/// #if !MOBILE
-import {removeBlockPanelEditors} from "../block/Panel";
+import {removeBlockPanelEditors} from "../block/panelRemoval";
/// #endif
export const reloadSync = (
diff --git a/app/src/window/index.ts b/app/src/window/index.ts
index f73ee0eda5..0e69f87f81 100644
--- a/app/src/window/index.ts
+++ b/app/src/window/index.ts
@@ -32,7 +32,7 @@ import {reloadSync} from "../util/reloadSync";
import {setTitle} from "../util/processTitle";
import {ensureUILayout} from "../util/ensureUILayout";
import {applyEntryVisibility} from "../config/entryVisibility/runtime";
-import {removeBlockPanelEditors} from "../block/Panel";
+import {removeBlockPanelEditors} from "../block/panelRemoval";
class App {
public plugins: import("../plugin").Plugin[] = [];