Skip to content

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

:art: https://github.com/siyuan-note/siyuan/issues/15885

Vanessa2f9d2afcd397
diff --git a/app/src/layout/util.ts b/app/src/layout/util.ts
index 0229521a8f..85f1d0c5b1 100644
--- a/app/src/layout/util.ts
+++ b/app/src/layout/util.ts
@@ -744,13 +744,20 @@ export const newModelByInitData = (app: App, tab: Tab, json: any) => {
});
}
} else if (json.instance === "Editor") {
+ if (json.rootId === json.blockId && json.action) {
+ if (typeof json.action === "string") {
+ json.action = json.action.replace(Constants.CB_GET_ALL, "");
+ } else if (typeof json.action === "object" && Array.isArray(json.action)) {
+ json.action = json.action.filter((item: string) => item !== Constants.CB_GET_ALL);
+ }
+ }
model = new Editor({
app,
tab,
rootId: json.rootId,
blockId: json.blockId,
mode: json.mode,
- action: typeof json.action === "string" ? [json.action, Constants.CB_GET_FOCUS] : json.action.concat(Constants.CB_GET_FOCUS),
+ action: typeof json.action === "string" ? (json.action ? [json.action, Constants.CB_GET_FOCUS] : [Constants.CB_GET_FOCUS]) : json.action.concat(Constants.CB_GET_FOCUS),
});
}
return model;