mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-20 08:30:12 +01:00
🎨 桌面端拖入文件时可选择 使用 file:// 绝对路径并链接 或 复制为资源文件并插入 https://github.com/siyuan-note/siyuan/issues/5369
This commit is contained in:
parent
40ade96b89
commit
6d99389c01
3 changed files with 15 additions and 9 deletions
|
|
@ -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", {});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue