Skip to content

Commit 393c539

Browse files
Vanessa21988250
authored andcommitted
🎨 #15801
Signed-off-by: Daniel <845765@qq.com>
1 parent a4f0319 commit 393c539

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

app/src/protyle/util/paste.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -508,11 +508,15 @@ export const paste = async (protyle: IProtyle, event: (ClipboardEvent | DragEven
508508
}
509509
if (linkElement) {
510510
const selectText = range.toString();
511-
protyle.toolbar.setInlineMark(protyle, "a", "range", {
511+
const aElements = protyle.toolbar.setInlineMark(protyle, "a", "range", {
512512
type: "a",
513513
color: `${linkElement.getAttribute("href")}${Constants.ZWSP}${selectText || linkElement.textContent}`
514514
});
515515
if (!selectText) {
516+
if(aElements[0].lastChild) {
517+
// https://github.com/siyuan-note/siyuan/issues/15801
518+
range.setEnd(aElements[0].lastChild, aElements[0].lastChild.textContent.length);
519+
}
516520
range.collapse(false);
517521
}
518522
return;

0 commit comments

Comments
 (0)