An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:art: 没有选中文本粘贴链接不应选中整个链接
Vanessa4244c1877903
diff --git a/app/src/protyle/toolbar/index.ts b/app/src/protyle/toolbar/index.tsindex 6965ccbda5..56c0c042d4 100644--- a/app/src/protyle/toolbar/index.ts+++ b/app/src/protyle/toolbar/index.ts@@ -193,7 +193,7 @@ export class Toolbar {startElement = startElement.parentElement;} else if (startElement.childElementCount > 0 && startElement.childNodes[range.startOffset]?.nodeType !== 3) {startElement = startElement.childNodes[range.startOffset] as HTMLElement;- if (startElement.tagName === "WBR") {+ if (startElement?.tagName === "WBR") {startElement = startElement.parentElement;}}diff --git a/app/src/protyle/util/paste.ts b/app/src/protyle/util/paste.tsindex 69872b1fae..6bc7140479 100644--- a/app/src/protyle/util/paste.ts+++ b/app/src/protyle/util/paste.ts@@ -544,10 +544,14 @@ export const paste = async (protyle: IProtyle, event: (ClipboardEvent | DragEven}}if (linkElement) {+ const selectText = range.toString();protyle.toolbar.setInlineMark(protyle, "a", "range", {type: "a",- color: `${linkElement.getAttribute("href")}${Constants.ZWSP}${range.toString()}`+ color: `${linkElement.getAttribute("href")}${Constants.ZWSP}${selectText || linkElement.textContent}`});+ if (!selectText) {+ range.collapse(false);+ }return;}fetchPost("/api/lute/html2BlockDOM", {