An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:art: https://github.com/siyuan-note/siyuan/issues/11072
Vanessaa2635a552045
diff --git a/app/src/boot/globalEvent/keydown.ts b/app/src/boot/globalEvent/keydown.tsindex 8f3e8c7fdc..b5c5f5985b 100644--- a/app/src/boot/globalEvent/keydown.ts+++ b/app/src/boot/globalEvent/keydown.ts@@ -214,10 +214,18 @@ const editKeydown = (app: App, event: KeyboardEvent) => {} else {protyle = activeTab.model.editors.unRefEdit.protyle;}- } else if (activeTab.model instanceof Custom && activeTab.model.data?.editor instanceof Protyle) {- protyle = activeTab.model.data.editor.protyle;- } else {- return false;+ } else if (activeTab.model instanceof Custom && activeTab.model.editors?.length > 0) {+ if (range) {+ activeTab.model.editors.find(item => {+ if (item.protyle.element.contains(range.startContainer)) {+ protyle = item.protyle;+ return true;+ }+ })+ }+ }+ if (!protyle) {+ return;}} else if (!protyle) {if (!protyle && range) {diff --git a/app/src/card/newCardTab.ts b/app/src/card/newCardTab.tsindex 49a9c0e225..997663a2b3 100644--- a/app/src/card/newCardTab.ts+++ b/app/src/card/newCardTab.ts@@ -45,7 +45,7 @@ export const newCardModel = (options: {cardsData: options.data.cardsData,index: options.data.index,});- this.data.editor = editor;+ customObj.editors.push(editor);// https://github.com/siyuan-note/siyuan/issues/9561#issuecomment-1794473512delete options.data.cardsData;delete options.data.index;@@ -75,7 +75,8 @@ export const newCardModel = (options: {cardType: this.data.cardType,cardsData,});- customObj.data.editor = editor;++ customObj.editors.push(editor);});}},diff --git a/app/src/layout/dock/Custom.ts b/app/src/layout/dock/Custom.tsindex 6d86d2d31f..ce08826bec 100644--- a/app/src/layout/dock/Custom.ts+++ b/app/src/layout/dock/Custom.ts@@ -1,6 +1,7 @@import {Tab} from "../Tab";import {Model} from "../Model";import {App} from "../../index";+import {Protyle} from "../../protyle";export class Custom extends Model {public element: Element;@@ -12,6 +13,7 @@ export class Custom extends Model {public beforeDestroy: () => void;public resize: () => void;public update: () => void;+ public editors: Protyle[] = [];constructor(options: {app: App,diff --git a/app/src/layout/getAll.ts b/app/src/layout/getAll.tsindex ef51f90368..1a73859801 100644--- a/app/src/layout/getAll.ts+++ b/app/src/layout/getAll.ts@@ -24,9 +24,9 @@ export const getAllEditor = () => {editors.push(item.editors.unRefEdit);});models.custom.forEach(item => {- if (item.data?.editor instanceof Protyle) {- editors.push(item.data.editor);- }+ item.editors?.forEach(eItem => {+ editors.push(eItem)+ })});models.backlink.forEach(item => {item.editors.forEach(editorItem => {diff --git a/app/src/layout/util.ts b/app/src/layout/util.tsindex 209d8cba19..80f2d30ca3 100644--- a/app/src/layout/util.ts+++ b/app/src/layout/util.ts@@ -579,8 +579,6 @@ export const layoutToJSON = (layout: Layout | Wnd | Tab | Model, json: any, breajson.instance = "Custom";json.customModelType = layout.type;json.customModelData = Object.assign({}, layout.data);- // https://github.com/siyuan-note/siyuan/issues/9250- delete json.customModelData.editor;}if (layout instanceof Layout || layout instanceof Wnd) {