🎨 桌面端拖入文件时可选择 使用 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

@ -16,6 +16,7 @@ import {Tab} from "../../layout/Tab";
import {getAllModels} from "../../layout/getAll";
import {updatePanelByEditor} from "../../editor/util";
/// #endif
import * as path from "path";
import {Editor} from "../../editor";
import {blockRender} from "../markdown/blockRender";
import {processRender} from "./processCode";
@ -23,7 +24,6 @@ import {highlightRender} from "../markdown/highlightRender";
import {uploadLocalFiles} from "../upload";
import {MenuItem} from "../../menus/Menu";
import {insertHTML} from "./insertHTML";
import {pathPosix} from "../../util/pathName";
const dragSb = (protyle: IProtyle, sourceElements: Element[], targetElement: Element, isBottom: boolean, direct: "col" | "row") => {
const isSameDoc = protyle.element.contains(sourceElements[0]);
@ -718,7 +718,7 @@ export const dropEvent = (protyle: IProtyle, editorElement: HTMLElement) => {
click() {
let fileText = "";
files.forEach((item) => {
fileText += `[${pathPosix().basename(item)}](file://${item})\n`;
fileText += `[${path.basename(item)}](file://${item})\n`;
});
insertHTML(protyle.lute.SpinBlockDOM(fileText), protyle);
}