🎨 桌面端拖入文件时可选择 使用 file:// 绝对路径并链接复制为资源文件并插入 https://github.com/siyuan-note/siyuan/issues/5369

This commit is contained in:
Liang Ding 2022-08-24 17:10:18 +08:00
parent 40ade96b89
commit 6d99389c01
No known key found for this signature in database
GPG key ID: 136F30F901A2231D
3 changed files with 15 additions and 9 deletions

View file

@ -69,7 +69,6 @@ export const pasteText = (protyle: IProtyle, textPlain: string, nodeElement: Ele
export const paste = async (protyle: IProtyle, event: (ClipboardEvent | DragEvent) & { target: HTMLElement }) => {
event.stopPropagation();
event.preventDefault();
let textHTML;
let textPlain;
let files;
@ -87,6 +86,7 @@ export const paste = async (protyle: IProtyle, event: (ClipboardEvent | DragEven
/// #if !MOBILE
if (!textHTML && !textPlain && ("clipboardData" in event)) {
if ("darwin" === window.siyuan.config.system.os) {
/// #if !BROWSER
const xmlString = clipboard.read("NSFilenamesPboardType");
const domParser = new DOMParser();
const xmlDom = domParser.parseFromString(xmlString, "application/xml");
@ -96,6 +96,7 @@ export const paste = async (protyle: IProtyle, event: (ClipboardEvent | DragEven
});
uploadLocalFiles(localFiles, protyle);
writeText("");
/// #endif
return;
} else {
const xmlString = await fetchSyncPost("/api/clipboard/readFilePaths", {});