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

Vanessaa053b51a41b8
diff --git a/app/src/protyle/util/clear.ts b/app/src/protyle/util/clear.ts
index 673472dc75..2574964c92 100644
--- a/app/src/protyle/util/clear.ts
+++ b/app/src/protyle/util/clear.ts
@@ -5,8 +5,8 @@ export const clearBlockElement = (element: Element) => {
element.classList.remove("protyle-wysiwyg--select", "protyle-wysiwyg--hl");
element.removeAttribute(Constants.CUSTOM_RIFF_DECKS);
element.removeAttribute("refcount");
- element.querySelector(".protyle-attr--av")?.remove();
element.querySelector(".protyle-attr--refcount")?.remove();
+ element.querySelector(".protyle-attr--av")?.remove();
element.removeAttribute("custom-avs");
element.getAttributeNames().forEach(attr => {
if (attr.startsWith("custom-sy-av-s-text-")) {
diff --git a/app/src/protyle/wysiwyg/transaction.ts b/app/src/protyle/wysiwyg/transaction.ts
index 02acfa81c5..a02d42663a 100644
--- a/app/src/protyle/wysiwyg/transaction.ts
+++ b/app/src/protyle/wysiwyg/transaction.ts
@@ -784,6 +784,7 @@ export const onTransaction = (protyle: IProtyle, operation: IOperation, isUndo:
if (previousElement.length === 0 && isUndo && protyle.wysiwyg.element.childElementCount === 0) {
// https://github.com/siyuan-note/siyuan/issues/15396 操作后撤销
protyle.wysiwyg.element.innerHTML = operation.data;
+ cursorElements.push(protyle.wysiwyg.element.firstElementChild);
} else if (previousElement.length === 0 && protyle.options.backlinkData && isUndo && getSelection().rangeCount > 0) {
// 反链面板删除超级块中的最后一个段落块后撤销
const blockElement = hasClosestBlock(getSelection().getRangeAt(0).startContainer);
@@ -856,6 +857,14 @@ export const onTransaction = (protyle: IProtyle, operation: IOperation, isUndo:
return;
}
cursorElements.forEach(item => {
+ // https://github.com/siyuan-note/siyuan/issues/16554
+ item.querySelector(".protyle-attr--av")?.remove();
+ item.removeAttribute("custom-avs");
+ item.getAttributeNames().forEach(attr => {
+ if (attr.startsWith("custom-sy-av-s-text-")) {
+ item.removeAttribute(attr);
+ }
+ });
processRender(item);
highlightRender(item);
avRender(item, protyle);