🎨 drag

This commit is contained in:
Vanessa 2023-10-26 17:35:48 +08:00
parent af651215a9
commit de9347fc97
2 changed files with 4 additions and 6 deletions

View file

@ -494,7 +494,7 @@ export class Files extends Model {
});
});
this.element.addEventListener("drop", async (event: DragEvent & { target: HTMLElement }) => {
const newElement = hasClosestByTag(event.target, "LI");
const newElement = this.element.querySelector(".dragover, .dragover__bottom, .dragover__top");
if (!newElement) {
return;
}

View file

@ -110,10 +110,8 @@ export const openMenuPanel = (options: {
event.stopPropagation();
return;
}
const target = event.target as HTMLElement;
const targetElement = hasClosestByAttribute(target, "draggable", "true");
if (!targetElement ||
(!targetElement.classList.contains("dragover__top") && !targetElement.classList.contains("dragover__bottom"))) {
const targetElement = avPanelElement.querySelector(".dragover__bottom, .dragover__top") as HTMLElement;
if (!targetElement) {
return;
}
let type = "columns";
@ -298,7 +296,7 @@ export const openMenuPanel = (options: {
const target = event.target as HTMLElement;
let targetElement = hasClosestByAttribute(target, "draggable", "true");
if (!targetElement) {
targetElement = hasClosestByAttribute(document.elementFromPoint(event.clientX, event.clientY - 1), "draggable", "true")
targetElement = hasClosestByAttribute(document.elementFromPoint(event.clientX, event.clientY - 1), "draggable", "true");
}
if (!targetElement || targetElement.isSameNode(window.siyuan.dragElement)) {
return;