mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-21 17:10:12 +01:00
This commit is contained in:
parent
014b2eab8d
commit
853d7f8d48
1 changed files with 34 additions and 19 deletions
|
|
@ -348,8 +348,15 @@ export class Files extends Model {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
liElement.classList.remove("dragover__top", "dragover__bottom", "dragover");
|
liElement.classList.remove("dragover__top", "dragover__bottom", "dragover");
|
||||||
if (window.siyuan.dragElement?.parentElement?.classList.contains("protyle-gutters")) {
|
let gutterType = "";
|
||||||
if (["NodeListItem", "NodeHeading"].includes(window.siyuan.dragElement.getAttribute("data-type"))) {
|
for (const item of event.dataTransfer.items) {
|
||||||
|
if (item.type.startsWith(Constants.SIYUAN_DROP_GUTTER)) {
|
||||||
|
gutterType = item.type;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (gutterType) {
|
||||||
|
const gutterTypes = gutterType.replace(Constants.SIYUAN_DROP_GUTTER, "").split(Constants.ZWSP);
|
||||||
|
if (["nodelistitem", "nodeheading"].includes(gutterTypes[0])) {
|
||||||
// 块标拖拽
|
// 块标拖拽
|
||||||
liElement.classList.add("dragover");
|
liElement.classList.add("dragover");
|
||||||
}
|
}
|
||||||
|
|
@ -416,23 +423,31 @@ export class Files extends Model {
|
||||||
}
|
}
|
||||||
const toURL = newUlElement.getAttribute("data-url");
|
const toURL = newUlElement.getAttribute("data-url");
|
||||||
const toPath = newElement.getAttribute("data-path");
|
const toPath = newElement.getAttribute("data-path");
|
||||||
const gutterType = window.siyuan.dragElement?.getAttribute("data-type");
|
let gutterType = "";
|
||||||
if (newElement.classList.contains("dragover") && ["NodeListItem", "NodeHeading"].includes(gutterType)) {
|
for (const item of event.dataTransfer.items) {
|
||||||
// 块标拖拽
|
if (item.type.startsWith(Constants.SIYUAN_DROP_GUTTER)) {
|
||||||
if (gutterType === "NodeHeading") {
|
gutterType = item.type;
|
||||||
fetchPost("/api/filetree/heading2Doc", {
|
}
|
||||||
targetNoteBook: toURL,
|
}
|
||||||
srcHeadingID: window.siyuan.dragElement.getAttribute("data-node-id"),
|
if (gutterType && newElement.classList.contains("dragover")) {
|
||||||
targetPath: toPath,
|
const gutterTypes = gutterType.replace(Constants.SIYUAN_DROP_GUTTER, "").split(Constants.ZWSP)
|
||||||
pushMode: 0,
|
if (["nodelistitem", "nodeheading"].includes(gutterTypes[0])) {
|
||||||
});
|
// 块标拖拽
|
||||||
} else {
|
if (gutterType === "nodeheading") {
|
||||||
fetchPost("/api/filetree/li2Doc", {
|
fetchPost("/api/filetree/heading2Doc", {
|
||||||
pushMode: 0,
|
targetNoteBook: toURL,
|
||||||
srcListItemID: window.siyuan.dragElement.getAttribute("data-node-id"),
|
srcHeadingID: gutterTypes[2].split(",")[0],
|
||||||
targetNoteBook: toURL,
|
targetPath: toPath,
|
||||||
targetPath: toPath
|
pushMode: 0,
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
fetchPost("/api/filetree/li2Doc", {
|
||||||
|
pushMode: 0,
|
||||||
|
srcListItemID: gutterTypes[2].split(",")[0],
|
||||||
|
targetNoteBook: toURL,
|
||||||
|
targetPath: toPath
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
newElement.classList.remove("dragover", "dragover__bottom", "dragover__top");
|
newElement.classList.remove("dragover", "dragover__bottom", "dragover__top");
|
||||||
window.siyuan.dragElement = undefined;
|
window.siyuan.dragElement = undefined;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue