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/11572

Vanessab153b5654428
diff --git a/app/src/protyle/wysiwyg/index.ts b/app/src/protyle/wysiwyg/index.ts
index 9927de2675..b06a9d5774 100644
--- a/app/src/protyle/wysiwyg/index.ts
+++ b/app/src/protyle/wysiwyg/index.ts
@@ -1816,6 +1816,27 @@ export class WYSIWYG {
event.preventDefault();
return;
}
+ if (!blockElement) {
+ return;
+ }
+ // 链接,备注,样式,引用,pdf标注粘贴 https://github.com/siyuan-note/siyuan/issues/11572
+ const range = getSelection().getRangeAt(0);
+ const inlineElement = range.startContainer.parentElement;
+ if (range.toString() === "" && inlineElement.tagName === "SPAN") {
+ const currentTypes = (inlineElement.getAttribute("data-type") || "").split(" ");
+ if (currentTypes.includes("inline-memo") || currentTypes.includes("text") ||
+ currentTypes.includes("block-ref") || currentTypes.includes("file-annotation-ref") ||
+ currentTypes.includes("a")) {
+ const offset = getSelectionOffset(inlineElement, blockElement, range);
+ if (offset.start === 0) {
+ range.setStartBefore(inlineElement);
+ range.collapse(true);
+ } else if (offset.start === inlineElement.textContent.length) {
+ range.setEndAfter(inlineElement);
+ range.collapse(false);
+ }
+ }
+ }
paste(protyle, event);
});