mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-21 09:00:12 +01:00
🎨 drag
This commit is contained in:
parent
af651215a9
commit
de9347fc97
2 changed files with 4 additions and 6 deletions
|
|
@ -494,7 +494,7 @@ export class Files extends Model {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
this.element.addEventListener("drop", async (event: DragEvent & { target: HTMLElement }) => {
|
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) {
|
if (!newElement) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -110,10 +110,8 @@ export const openMenuPanel = (options: {
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const target = event.target as HTMLElement;
|
const targetElement = avPanelElement.querySelector(".dragover__bottom, .dragover__top") as HTMLElement;
|
||||||
const targetElement = hasClosestByAttribute(target, "draggable", "true");
|
if (!targetElement) {
|
||||||
if (!targetElement ||
|
|
||||||
(!targetElement.classList.contains("dragover__top") && !targetElement.classList.contains("dragover__bottom"))) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let type = "columns";
|
let type = "columns";
|
||||||
|
|
@ -298,7 +296,7 @@ export const openMenuPanel = (options: {
|
||||||
const target = event.target as HTMLElement;
|
const target = event.target as HTMLElement;
|
||||||
let targetElement = hasClosestByAttribute(target, "draggable", "true");
|
let targetElement = hasClosestByAttribute(target, "draggable", "true");
|
||||||
if (!targetElement) {
|
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)) {
|
if (!targetElement || targetElement.isSameNode(window.siyuan.dragElement)) {
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue