diff --git a/app/src/protyle/util/paste.ts b/app/src/protyle/util/paste.ts index 2552907aa..ea030de3e 100644 --- a/app/src/protyle/util/paste.ts +++ b/app/src/protyle/util/paste.ts @@ -508,11 +508,15 @@ export const paste = async (protyle: IProtyle, event: (ClipboardEvent | DragEven } if (linkElement) { const selectText = range.toString(); - protyle.toolbar.setInlineMark(protyle, "a", "range", { + const aElements = protyle.toolbar.setInlineMark(protyle, "a", "range", { type: "a", color: `${linkElement.getAttribute("href")}${Constants.ZWSP}${selectText || linkElement.textContent}` }); if (!selectText) { + if(aElements[0].lastChild) { + // https://github.com/siyuan-note/siyuan/issues/15801 + range.setEnd(aElements[0].lastChild, aElements[0].lastChild.textContent.length); + } range.collapse(false); } return;