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

Vanessa7879c7a72a77
diff --git a/app/src/dialog/processSystem.ts b/app/src/dialog/processSystem.ts
index 38d69002c3..64c8ff4f46 100644
--- a/app/src/dialog/processSystem.ts
+++ b/app/src/dialog/processSystem.ts
@@ -14,7 +14,7 @@ import {escapeHtml} from "../util/escape";
import {getWorkspaceName} from "../util/noRelyPCFunction";
import {needSubscribe} from "../util/needSubscribe";
import {redirectToCheckAuth, setNoteBook} from "../util/pathName";
-import {getAllModels} from "../layout/getAll";
+import {getAllEditor, getAllModels} from "../layout/getAll";
import {reloadProtyle} from "../protyle/util/reload";
import {Tab} from "../layout/Tab";
import {setEmpty} from "../mobile/util/setEmpty";
@@ -144,6 +144,22 @@ export const reloadSync = (
/// #endif
};
+export const setRefDynamicText = (data: {
+ "blockID": string,
+ "defBlockID": string,
+ "refText": string,
+ "rootID": string
+}) => {
+ getAllEditor().forEach(item => {
+ if (item.protyle.block.rootID === data.rootID) {
+ const refElement = item.protyle.wysiwyg.element.querySelector(`[data-node-id="${data.blockID}"] span[data-type="block-ref"][data-subtype="d"][data-id="${data.defBlockID}"]`);
+ if (refElement) {
+ refElement.innerHTML = data.refText;
+ }
+ }
+ })
+}
+
export const lockScreen = (app: App) => {
if (window.siyuan.config.readonly) {
return;
diff --git a/app/src/index.ts b/app/src/index.ts
index 7bb3f50784..e0f21faa8f 100644
--- a/app/src/index.ts
+++ b/app/src/index.ts
@@ -17,7 +17,7 @@ import {
progressBackgroundTask,
progressLoading,
progressStatus,
- reloadSync,
+ reloadSync, setRefDynamicText,
setTitle,
transactionError
} from "./dialog/processSystem";
@@ -61,6 +61,9 @@ export class App {
});
if (data) {
switch (data.cmd) {
+ case "setRefDynamicText":
+ setRefDynamicText(data.data);
+ break;
case "reloadPlugin":
reloadPlugin(this, data.data);
break;