mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-21 07:46:09 +01:00
This commit is contained in:
parent
0cdeacbbd9
commit
3185c8ff6f
1 changed files with 8 additions and 1 deletions
|
|
@ -485,6 +485,7 @@ export class Files extends Model {
|
|||
});
|
||||
/// #endif
|
||||
});
|
||||
let dragoverLiObj: { element: HTMLElement, rect: DOMRect };
|
||||
this.element.addEventListener("dragover", (event: DragEvent & { target: HTMLElement }) => {
|
||||
if (window.siyuan.config.readonly || event.dataTransfer.types.includes(Constants.SIYUAN_DROP_TAB)) {
|
||||
return;
|
||||
|
|
@ -497,6 +498,12 @@ export class Files extends Model {
|
|||
event.preventDefault();
|
||||
return;
|
||||
}
|
||||
if (!dragoverLiObj || dragoverLiObj.element !== liElement) {
|
||||
dragoverLiObj = {
|
||||
element: liElement,
|
||||
rect: liElement.getBoundingClientRect()
|
||||
};
|
||||
}
|
||||
this.element.querySelectorAll(".dragover, .dragover__bottom, .dragover__top").forEach((item: HTMLElement) => {
|
||||
item.classList.remove("dragover", "dragover__bottom", "dragover__top");
|
||||
});
|
||||
|
|
@ -538,7 +545,7 @@ export class Files extends Model {
|
|||
(!sourceOnlyRoot && targetType !== "navigation-root" &&
|
||||
(notebookSort === "6" || (window.siyuan.config.fileTree.sort === 6 && notebookSort === "15")))
|
||||
) {
|
||||
const nodeRect = liElement.getBoundingClientRect();
|
||||
const nodeRect = dragoverLiObj.rect;
|
||||
const dragHeight = nodeRect.height * .2;
|
||||
if (targetType === "navigation-root" && sourceOnlyRoot) {
|
||||
if (event.clientY > nodeRect.top + nodeRect.height / 2) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue