Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: https://github.com/siyuan-note/siyuan/issues/15801

Vanessa393c53941a04
diff --git a/app/src/protyle/util/paste.ts b/app/src/protyle/util/paste.ts
index 2552907aa8..ea030de3e5 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;