Vanessa 2025-06-30 12:26:47 +08:00
parent 751e10196c
commit c9eae83501
3 changed files with 19 additions and 5 deletions

View file

@ -31,7 +31,7 @@ import {zoomOut} from "../../menus/protyle";
/// #if !BROWSER
import {webUtils} from "electron";
/// #endif
import {addDragFill} from "../render/av/cell";
import {addDragFill, getTypeByCellElement} from "../render/av/cell";
import {processClonePHElement} from "../render/util";
import {insertGalleryItemAnimation} from "../render/av/gallery/item";
import {clearSelect} from "./clearSelect";
@ -1316,13 +1316,13 @@ export const dropEvent = (protyle: IProtyle, editorElement: HTMLElement) => {
} else {
const cellElement = hasClosestByClassName(event.target, "av__cell");
if (cellElement) {
const cellType = avElement.querySelector(`.av__row--header [data-col-id="${cellElement.dataset.colId}"]`)?.getAttribute("data-dtype");
if (cellType === "mAsset" && event.dataTransfer.types[0] === "Files" && !isBrowser()) {
if (getTypeByCellElement(cellElement) === "mAsset" && event.dataTransfer.types[0] === "Files" && !isBrowser()) {
const files: string[] = [];
for (let i = 0; i < event.dataTransfer.files.length; i++) {
files.push(webUtils.getPathForFile(event.dataTransfer.files[i]));
}
dragUpload(files, protyle, cellElement);
clearSelect(["cell"], avElement);
}
}
}
@ -1362,7 +1362,9 @@ export const dropEvent = (protyle: IProtyle, editorElement: HTMLElement) => {
if (blockElement) {
clearSelect(["cell", "row"], protyle.wysiwyg.element);
targetElement.classList.add("av__cell--select");
addDragFill(targetElement);
if (blockElement.getAttribute("data-av-type") !== "gallery") {
addDragFill(targetElement);
}
dragoverElement = targetElement;
}
}