From 23e09027e7abdff8c3e7007ea79fd485c9d3c74c Mon Sep 17 00:00:00 2001 From: Vanessa Date: Wed, 24 Aug 2022 15:46:45 +0800 Subject: [PATCH] :art: https://github.com/siyuan-note/siyuan/issues/5369 --- app/src/protyle/util/editorCommonEvent.ts | 12 ++++++------ app/src/protyle/wysiwyg/keydown.ts | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/app/src/protyle/util/editorCommonEvent.ts b/app/src/protyle/util/editorCommonEvent.ts index f7693a1c3..75d8fea87 100644 --- a/app/src/protyle/util/editorCommonEvent.ts +++ b/app/src/protyle/util/editorCommonEvent.ts @@ -695,7 +695,7 @@ export const dropEvent = (protyle: IProtyle, editorElement: HTMLElement) => { // 外部文件拖入编辑器中或者编辑器内选中文字拖拽 focusByRange(document.caretRangeFromPoint(event.clientX, event.clientY)); if (event.dataTransfer.types[0] === "Files") { - const files:string[] = []; + const files: string[] = []; let isAllFile = true; for (let i = 0; i < event.dataTransfer.files.length; i++) { files.push(event.dataTransfer.files[i].path); @@ -706,19 +706,19 @@ export const dropEvent = (protyle: IProtyle, editorElement: HTMLElement) => { if (isAllFile) { window.siyuan.menus.menu.remove(); window.siyuan.menus.menu.append(new MenuItem({ - label:window.siyuan.languages.copyInsertAsAssets, - icon:"iconUpload", + label: window.siyuan.languages.copyInsertAsAssets, + icon: "iconUpload", click() { uploadLocalFiles(files, protyle); } }).element); window.siyuan.menus.menu.append(new MenuItem({ - label:window.siyuan.languages.useFileProtoLink, - icon:"iconLink", + label: window.siyuan.languages.useFileProtoLink, + icon: "iconLink", click() { let fileText = ""; files.forEach((item) => { - fileText = `[${pathPosix().basename(item)}](file://${item})\n`; + fileText += `[${pathPosix().basename(item)}](file://${item})\n`; }); insertHTML(protyle.lute.SpinBlockDOM(fileText), protyle); } diff --git a/app/src/protyle/wysiwyg/keydown.ts b/app/src/protyle/wysiwyg/keydown.ts index edf7f5636..b55089f4b 100644 --- a/app/src/protyle/wysiwyg/keydown.ts +++ b/app/src/protyle/wysiwyg/keydown.ts @@ -1587,7 +1587,7 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => { if (localFiles.length > 0) { let fileText = "" localFiles.forEach((item) => { - fileText = `[${pathPosix().basename(item)}](file://${item})\n`; + fileText += `[${pathPosix().basename(item)}](file://${item})\n`; }); insertHTML(protyle.lute.SpinBlockDOM(fileText), protyle); } else {