diff --git a/app/src/protyle/util/clear.ts b/app/src/protyle/util/clear.ts index 673472dc7..2574964c9 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 02acfa81c..a02d42663 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);