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

Vanessa2fe19d96685a
diff --git a/app/src/protyle/wysiwyg/input.ts b/app/src/protyle/wysiwyg/input.ts
index 9ba3de0968..9aa8487a8a 100644
--- a/app/src/protyle/wysiwyg/input.ts
+++ b/app/src/protyle/wysiwyg/input.ts
@@ -10,7 +10,7 @@ import {genEmptyBlock} from "../../block/util";
import {blockRender} from "../markdown/blockRender";
import {hideElements} from "../ui/hideElements";
import {hasClosestByAttribute} from "../util/hasClosest";
-import {fetchSyncPost} from "../../util/fetch";
+import {fetchPost, fetchSyncPost} from "../../util/fetch";
export const input = async (protyle: IProtyle, blockElement: HTMLElement, range: Range, needRender = true) => {
if (!blockElement.parentElement) {
@@ -182,6 +182,14 @@ export const input = async (protyle: IProtyle, blockElement: HTMLElement, range:
} else if (realType === "NodeThematicBreak" && focusHR) {
focusBlock(blockElement);
} else {
+ // https://github.com/siyuan-note/siyuan/issues/6087
+ realElement.querySelectorAll('[data-type="block-ref"][data-subtype="d"]').forEach(refItem => {
+ if (refItem.textContent === "") {
+ fetchPost("/api/block/getRefText", {id: refItem.getAttribute("data-id")}, (response) => {
+ refItem.innerHTML = response.data;
+ });
+ }
+ });
mathRender(realElement);
if (index === tempElement.content.childElementCount - 1) {
focusByWbr(protyle.wysiwyg.element, range);