Skip to content

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

:bug: https://github.com/siyuan-note/siyuan/issues/14783

Vanessa83053e14418c
diff --git a/app/src/protyle/util/paste.ts b/app/src/protyle/util/paste.ts
index 52464ab9e4..e172c5dc08 100644
--- a/app/src/protyle/util/paste.ts
+++ b/app/src/protyle/util/paste.ts
@@ -398,7 +398,7 @@ export const paste = async (protyle: IProtyle, event: (ClipboardEvent | DragEven
// 编辑器内部粘贴
const tempElement = document.createElement("div");
tempElement.innerHTML = siyuanHTML;
- if (tempElement.childElementCount === 1) {
+ if (tempElement.childElementCount === 1 && range.toString()) {
const types = ((tempElement.firstElementChild as HTMLElement).dataset?.type || "").split(" ");
if (types.includes("block-ref")) {
protyle.toolbar.setInlineMark(protyle, "block-ref", "range", {
@@ -511,7 +511,7 @@ export const paste = async (protyle: IProtyle, event: (ClipboardEvent | DragEven
e.remove();
}
});
- if (tempElement.childElementCount === 1 && tempElement.firstElementChild.tagName === "A") {
+ if (tempElement.childElementCount === 1 && tempElement.firstElementChild.tagName === "A" && range.toString()) {
protyle.toolbar.setInlineMark(protyle, "a", "range", {
type: "a",
color: (tempElement.firstElementChild as HTMLLinkElement).href