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

Vanessa4f3a46d839e4
diff --git a/app/src/protyle/util/paste.ts b/app/src/protyle/util/paste.ts
index 04e894664d..d321c5379a 100644
--- a/app/src/protyle/util/paste.ts
+++ b/app/src/protyle/util/paste.ts
@@ -355,7 +355,12 @@ export const paste = async (protyle: IProtyle, event: (ClipboardEvent | DragEven
}
}
- const nodeElement = hasClosestBlock(event.target);
+
+ let nodeElement = hasClosestBlock(event.target);
+ const range = getEditorRange(protyle.wysiwyg.element);
+ if (!nodeElement) {
+ nodeElement = hasClosestBlock(range.startContainer);
+ }
if (!nodeElement) {
if (files && files.length > 0) {
uploadFiles(protyle, files);
@@ -368,7 +373,6 @@ export const paste = async (protyle: IProtyle, event: (ClipboardEvent | DragEven
item.classList.remove("protyle-wysiwyg--hl");
});
const code = processPasteCode(textHTML, textPlain, originalTextHTML, protyle);
- const range = getEditorRange(protyle.wysiwyg.element);
if (nodeElement.getAttribute("data-type") === "NodeCodeBlock" ||
protyle.toolbar.getCurrentType(range).includes("code")) {
// https://github.com/siyuan-note/siyuan/issues/13552