From 2fe19d96685a5696c3bae83314fa02621ddea9b5 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Sat, 8 Oct 2022 11:14:53 +0800 Subject: [PATCH] :art: fix https://github.com/siyuan-note/siyuan/issues/6087 --- app/src/protyle/wysiwyg/input.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/app/src/protyle/wysiwyg/input.ts b/app/src/protyle/wysiwyg/input.ts index 9ba3de096..9aa8487a8 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);