From 79812f22b690d4017f6ce98fb12a0b67f68c14ff Mon Sep 17 00:00:00 2001 From: Vanessa Date: Mon, 28 Apr 2025 12:14:59 +0800 Subject: [PATCH] :art: https://github.com/siyuan-note/siyuan/issues/14704 --- app/src/protyle/toolbar/Font.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/app/src/protyle/toolbar/Font.ts b/app/src/protyle/toolbar/Font.ts index a11e43c28..78aca5a53 100644 --- a/app/src/protyle/toolbar/Font.ts +++ b/app/src/protyle/toolbar/Font.ts @@ -291,10 +291,15 @@ export const setFontStyle = (textElement: HTMLElement, textOption: ITextOption) const setBlockRef = (blockRefOption: string) => { const blockRefData = blockRefOption.split(Constants.ZWSP); // 标签等元素中包含 ZWSP,需移除后拼接 https://github.com/siyuan-note/siyuan/issues/6466 - textElement.setAttribute("data-id", blockRefData.splice(0, 1)[0]); + const id = blockRefData.splice(0, 1)[0]; + textElement.setAttribute("data-id", id); textElement.setAttribute("data-subtype", blockRefData.splice(0, 1)[0]); textElement.removeAttribute("data-href"); - textElement.innerText = blockRefData.join(""); + let text = blockRefData.join(""); + if (text.replace(/\s/g, "") === "") { + text = id; + } + textElement.innerText = text; }; const setLink = (textOption: string) => { const options = textOption.split(Constants.ZWSP);