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

Vanessa37fbc6613ab4
diff --git a/app/src/protyle/wysiwyg/remove.ts b/app/src/protyle/wysiwyg/remove.ts
index 9358245865..f05ac4f394 100644
--- a/app/src/protyle/wysiwyg/remove.ts
+++ b/app/src/protyle/wysiwyg/remove.ts
@@ -469,7 +469,16 @@ export const removeCrossBlockRange = async (protyle: IProtyle, selectedRange: Ra
hasClosestByTag(item.range.startContainer, "SPAN"),
hasClosestByTag(item.range.endContainer, "SPAN"),
].filter(Boolean) as HTMLElement[]);
+ const dynamicRefTexts = new Map(Array.from(boundarySpans)
+ .filter(refElement => refElement.getAttribute("data-type")?.split(" ").includes("block-ref") &&
+ refElement.getAttribute("data-subtype") === "d")
+ .map(refElement => [refElement, refElement.textContent] as const));
item.range.deleteContents();
+ dynamicRefTexts.forEach((text, refElement) => {
+ if (refElement.isConnected && refElement.textContent !== text) {
+ refElement.setAttribute("data-subtype", "s");
+ }
+ });
boundarySpans.forEach(spanElement => {
if (spanElement.isConnected && spanElement.textContent === "" && !spanElement.querySelector("img")) {
spanElement.remove();