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

Vanessa31b97d86d0b6
diff --git a/app/src/protyle/util/compatibility.ts b/app/src/protyle/util/compatibility.ts
index 35bc97ba38..c4a70e2afb 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 c976e557b1..218aff5a14 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)) {