mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-21 09:00:12 +01:00
This commit is contained in:
parent
0e7f68114d
commit
12847659d2
3 changed files with 5 additions and 2 deletions
|
|
@ -16,6 +16,7 @@ export abstract class Constants {
|
|||
|
||||
// drop 事件
|
||||
public static readonly SIYUAN_DROP_FILE: string = "application/siyuan-file";
|
||||
public static readonly SIYUAN_DROP_GUTTER: string = "application/siyuan-gutter";
|
||||
public static readonly SIYUAN_DROP_TAB: string = "application/siyuan-tab";
|
||||
public static readonly SIYUAN_DROP_TABTOWINDOW: string = "application/siyuan-tabtowindow";
|
||||
public static readonly SIYUAN_DROP_EDITOR: string = "application/siyuan-editor";
|
||||
|
|
|
|||
|
|
@ -58,6 +58,7 @@ export class Gutter {
|
|||
}
|
||||
event.target.style.opacity = "0.1";
|
||||
window.siyuan.dragElement = event.target;
|
||||
event.dataTransfer.setData(Constants.SIYUAN_DROP_GUTTER, selectIds.toString());
|
||||
window.siyuan.dragElement.setAttribute("data-selected-ids", selectIds.toString());
|
||||
});
|
||||
this.element.addEventListener("dragend", () => {
|
||||
|
|
|
|||
|
|
@ -708,6 +708,7 @@ export const dropEvent = (protyle: IProtyle, editorElement: HTMLElement) => {
|
|||
window.siyuan.dragElement = undefined;
|
||||
event.preventDefault();
|
||||
} else {
|
||||
event.dataTransfer.setData(Constants.SIYUAN_DROP_GUTTER, target.parentElement.getAttribute("data-node-id"));
|
||||
window.siyuan.dragElement = target.parentElement;
|
||||
}
|
||||
return;
|
||||
|
|
@ -846,6 +847,7 @@ export const dropEvent = (protyle: IProtyle, editorElement: HTMLElement) => {
|
|||
event.preventDefault();
|
||||
return;
|
||||
}
|
||||
// TODO !event.dataTransfer.types.includes(Constants.SIYUAN_DROP_GUTTER) https://github.com/siyuan-note/siyuan/issues/7284
|
||||
if (!window.siyuan.dragElement) {
|
||||
// https://github.com/siyuan-note/siyuan/issues/6436
|
||||
event.preventDefault();
|
||||
|
|
@ -865,7 +867,7 @@ export const dropEvent = (protyle: IProtyle, editorElement: HTMLElement) => {
|
|||
if (!targetElement) {
|
||||
return;
|
||||
}
|
||||
const fileTreeIds = window.siyuan.dragElement.innerText;
|
||||
const fileTreeIds = window.siyuan.dragElement ? window.siyuan.dragElement.innerText || "";
|
||||
if (targetElement && dragoverElement && targetElement.isSameNode(dragoverElement)) {
|
||||
// 性能优化,目标为同一个元素不再进行校验
|
||||
const nodeRect = targetElement.getBoundingClientRect();
|
||||
|
|
@ -901,7 +903,6 @@ export const dropEvent = (protyle: IProtyle, editorElement: HTMLElement) => {
|
|||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (window.siyuan.dragElement.parentElement?.classList.contains("protyle-gutters") ||
|
||||
// 列表项之前的点
|
||||
window.siyuan.dragElement.getAttribute("data-type") === "NodeListItem") {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue