Signed-off-by: Daniel <845765@qq.com>
This commit is contained in:
Vanessa 2025-09-08 10:56:54 +08:00 committed by Daniel
parent a4f03191fa
commit 393c53941a
No known key found for this signature in database
GPG key ID: 86211BA83DF03017

View file

@ -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;