Vanessa 2025-02-19 12:48:22 +08:00
parent 80af4ad069
commit 31b97d86d0
2 changed files with 3 additions and 3 deletions

View File

@ -40,7 +40,7 @@ export const readText = () => {
}; };
export const readClipboard = async () => { export const readClipboard = async () => {
const text: { textPlain?: string, textHTML?: string } = {}; const text = {textPlain: "", textHTML: ""};
if (isInAndroid()) { if (isInAndroid()) {
text.textPlain = window.JSAndroid.readClipboard(); text.textPlain = window.JSAndroid.readClipboard();
} else if (isInHarmony()) { } else if (isInHarmony()) {

View File

@ -128,7 +128,7 @@ export const pasteEscaped = async (protyle: IProtyle, nodeElement: Element) => {
.replace(/\|/g, "\\|") .replace(/\|/g, "\\|")
.replace(/\./g, "\\."); .replace(/\./g, "\\.");
// 转义文本不能使用 DOM 结构 https://github.com/siyuan-note/siyuan/issues/11778 // 转义文本不能使用 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) { } catch (e) {
console.log(e); console.log(e);
} }
@ -496,7 +496,7 @@ export const paste = async (protyle: IProtyle, event: (ClipboardEvent | DragEven
} else if (files && files.length > 0) { } else if (files && files.length > 0) {
uploadFiles(protyle, files); uploadFiles(protyle, files);
return; return;
} else if (textPlain.trim() !== "" && files && files.length === 0) { } else if (textPlain.trim() !== "" && (files && files.length === 0 || !files)) {
if (range.toString() !== "") { if (range.toString() !== "") {
const firstLine = textPlain.split("\n")[0]; const firstLine = textPlain.split("\n")[0];
if (isDynamicRef(textPlain)) { if (isDynamicRef(textPlain)) {