mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-21 17:10:12 +01:00
This commit is contained in:
parent
87dcbcd58c
commit
32ec165065
2 changed files with 33 additions and 2 deletions
|
|
@ -349,10 +349,16 @@ export class Files extends Model {
|
|||
}
|
||||
let ids = "";
|
||||
const ghostElement = document.createElement("ul");
|
||||
selectElements.forEach((item: HTMLElement) => {
|
||||
selectElements.forEach((item: HTMLElement, index) => {
|
||||
ghostElement.append(item.cloneNode(true));
|
||||
item.style.opacity = "0.1";
|
||||
ids += (item.getAttribute("data-node-id") || "") + ",";
|
||||
const itemNodeId = item.getAttribute("data-node-id") || ""
|
||||
if (itemNodeId) {
|
||||
ids += itemNodeId;
|
||||
if (index < selectElements.length - 1) {
|
||||
ids += ",";
|
||||
}
|
||||
}
|
||||
});
|
||||
ghostElement.setAttribute("style", `width: 219px;position: fixed;top:-${selectElements.length * 30}px`);
|
||||
ghostElement.setAttribute("class", "b3-list b3-list--background");
|
||||
|
|
|
|||
|
|
@ -917,6 +917,31 @@ export const dropEvent = (protyle: IProtyle, editorElement: HTMLElement) => {
|
|||
// 文件树拖拽
|
||||
const scrollTop = protyle.contentElement.scrollTop;
|
||||
const ids = event.dataTransfer.getData(Constants.SIYUAN_DROP_FILE).split(",");
|
||||
if (targetElement.classList.contains("av__row")) {
|
||||
// 拖拽到属性视图内
|
||||
const blockElement = hasClosestBlock(targetElement);
|
||||
if (!blockElement) {
|
||||
return;
|
||||
}
|
||||
let previousID = "";
|
||||
if (targetElement.classList.contains("dragover__bottom")) {
|
||||
previousID = targetElement.getAttribute("data-id") || "";
|
||||
} else {
|
||||
previousID = targetElement.previousElementSibling?.getAttribute("data-id") || "";
|
||||
}
|
||||
const avID = blockElement.getAttribute("data-av-id");
|
||||
transaction(protyle, [{
|
||||
action: "insertAttrViewBlock",
|
||||
avID,
|
||||
previousID,
|
||||
srcIDs: ids,
|
||||
}], [{
|
||||
action: "removeAttrViewBlock",
|
||||
srcIDs: ids,
|
||||
avID,
|
||||
}]);
|
||||
return;
|
||||
}
|
||||
for (let i = 0; i < ids.length; i++) {
|
||||
if (ids[i]) {
|
||||
await fetchSyncPost("/api/filetree/doc2Heading", {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue