|
@@ -129,20 +129,17 @@ export class Wnd {
|
|
|
}
|
|
|
});
|
|
|
this.headersElement.addEventListener("dragover", function (event: DragEvent & { target: HTMLElement }) {
|
|
|
- if (!window.siyuan.dragElement ||
|
|
|
- (!event.dataTransfer.types.includes(Constants.SIYUAN_DROP_TAB) && !event.dataTransfer.types.includes(Constants.SIYUAN_DROP_FILE))) {
|
|
|
- return;
|
|
|
- }
|
|
|
- if (window.siyuan.dragElement.getAttribute("data-type") === "navigation-root") {
|
|
|
- // 文档数中笔记本不能拖拽打开
|
|
|
- return;
|
|
|
- }
|
|
|
- event.preventDefault();
|
|
|
const it = this as HTMLElement;
|
|
|
if (event.dataTransfer.types.includes(Constants.SIYUAN_DROP_FILE)) {
|
|
|
+ event.preventDefault();
|
|
|
it.style.opacity = ".1";
|
|
|
return;
|
|
|
}
|
|
|
+ if (!event.dataTransfer.types.includes(Constants.SIYUAN_DROP_TAB) ||
|
|
|
+ (!window.siyuan.dragElement && event.dataTransfer.types.includes(Constants.SIYUAN_DROP_TAB))) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ event.preventDefault();
|
|
|
const newTabHeaderElement = hasClosestByTag(event.target, "LI");
|
|
|
let oldTabHeaderElement = window.siyuan.dragElement;
|
|
|
let exitDrag = false;
|
|
@@ -197,9 +194,13 @@ export class Wnd {
|
|
|
if (event.dataTransfer.types.includes(Constants.SIYUAN_DROP_FILE)) {
|
|
|
// 文档树拖拽
|
|
|
setPanelFocus(it.parentElement.parentElement);
|
|
|
- openFileById({
|
|
|
- id: window.siyuan.dragElement.getAttribute("data-node-id"),
|
|
|
- action: [Constants.CB_GET_FOCUS, Constants.CB_GET_SCROLL]
|
|
|
+ event.dataTransfer.getData(Constants.SIYUAN_DROP_FILE).split(",").forEach(item => {
|
|
|
+ if (item) {
|
|
|
+ openFileById({
|
|
|
+ id: item,
|
|
|
+ action: [Constants.CB_GET_FOCUS, Constants.CB_GET_SCROLL]
|
|
|
+ });
|
|
|
+ }
|
|
|
});
|
|
|
window.siyuan.dragElement = undefined;
|
|
|
it.style.opacity = "";
|