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

Vanessa200c1fb12752
diff --git a/app/src/menus/protyle.ts b/app/src/menus/protyle.ts
index 5647951d44..375a1d8a15 100644
--- a/app/src/menus/protyle.ts
+++ b/app/src/menus/protyle.ts
@@ -363,7 +363,7 @@ export const refMenu = (protyle: IProtyle, element: HTMLElement) => {
inputElement.addEventListener("input", () => {
if (inputElement.value) {
// 不能使用 textContent,否则 < 会变为 &lt;
- element.innerHTML = Lute.EscapeHTMLStr(inputElement.value);
+ element.innerHTML = Lute.EscapeHTMLStr(inputElement.value).trim() || refBlockId;
} else {
fetchPost("/api/block/getRefText", {id: refBlockId}, (response) => {
element.innerHTML = response.data;
@@ -1517,12 +1517,12 @@ style="margin:4px 0;width: ${isMobile() ? "100%" : "360px"}" class="b3-text-fiel
}
inputElements[1].value = anchor;
inputElements[1].addEventListener("compositionend", () => {
- linkElement.innerHTML = Lute.EscapeHTMLStr(inputElements[1].value.replace(/\n|\r\n|\r|\u2028|\u2029/g, "") || "*");
+ linkElement.innerHTML = Lute.EscapeHTMLStr(inputElements[1].value.replace(/\n|\r\n|\r|\u2028|\u2029/g, "").trim() || "*");
});
inputElements[1].addEventListener("input", (event: KeyboardEvent) => {
if (!event.isComposing) {
// https://github.com/siyuan-note/siyuan/issues/4511
- linkElement.innerHTML = Lute.EscapeHTMLStr(inputElements[1].value.replace(/\n|\r\n|\r|\u2028|\u2029/g, "")) || "*";
+ linkElement.innerHTML = Lute.EscapeHTMLStr(inputElements[1].value.replace(/\n|\r\n|\r|\u2028|\u2029/g, "").trim()) || "*";
}
});
inputElements[1].addEventListener("keydown", (event) => {