From 393c53941a041dd7375d6d8b12a50daf501e4061 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Mon, 8 Sep 2025 10:56:54 +0800 Subject: [PATCH] :art: https://github.com/siyuan-note/siyuan/issues/15801 Signed-off-by: Daniel <845765@qq.com> --- app/src/protyle/util/paste.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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;