From 31b97d86d0b6ec3d9b04cc896950bfa5c60629bb Mon Sep 17 00:00:00 2001 From: Vanessa Date: Wed, 19 Feb 2025 12:48:22 +0800 Subject: [PATCH] :bug: https://github.com/siyuan-note/siyuan/issues/14136 --- app/src/protyle/util/compatibility.ts | 2 +- app/src/protyle/util/paste.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/protyle/util/compatibility.ts b/app/src/protyle/util/compatibility.ts index 35bc97ba3..c4a70e2af 100644 --- a/app/src/protyle/util/compatibility.ts +++ b/app/src/protyle/util/compatibility.ts @@ -40,7 +40,7 @@ export const readText = () => { }; export const readClipboard = async () => { - const text: { textPlain?: string, textHTML?: string } = {}; + const text = {textPlain: "", textHTML: ""}; if (isInAndroid()) { text.textPlain = window.JSAndroid.readClipboard(); } else if (isInHarmony()) { diff --git a/app/src/protyle/util/paste.ts b/app/src/protyle/util/paste.ts index c976e557b..218aff5a1 100644 --- a/app/src/protyle/util/paste.ts +++ b/app/src/protyle/util/paste.ts @@ -128,7 +128,7 @@ export const pasteEscaped = async (protyle: IProtyle, nodeElement: Element) => { .replace(/\|/g, "\\|") .replace(/\./g, "\\."); // 转义文本不能使用 DOM 结构 https://github.com/siyuan-note/siyuan/issues/11778 - paste(protyle, {textPlain: clipText, target: nodeElement as HTMLElement}); + paste(protyle, {textPlain: clipText, textHTML: "", target: nodeElement as HTMLElement}); } catch (e) { console.log(e); } @@ -496,7 +496,7 @@ export const paste = async (protyle: IProtyle, event: (ClipboardEvent | DragEven } else if (files && files.length > 0) { uploadFiles(protyle, files); return; - } else if (textPlain.trim() !== "" && files && files.length === 0) { + } else if (textPlain.trim() !== "" && (files && files.length === 0 || !files)) { if (range.toString() !== "") { const firstLine = textPlain.split("\n")[0]; if (isDynamicRef(textPlain)) {