mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-22 09:30:14 +01:00
This commit is contained in:
parent
e4a128123d
commit
3f0c6675a9
3 changed files with 74 additions and 61 deletions
|
|
@ -389,37 +389,44 @@ export const openMenuPanel = (options: {
|
|||
return;
|
||||
}
|
||||
|
||||
transaction(options.protyle, [{
|
||||
action: "sortAttrViewCol",
|
||||
avID,
|
||||
previousID: (targetElement.classList.contains("dragover__top") ? targetElement.previousElementSibling?.getAttribute("data-id") : targetElement.getAttribute("data-id")) || "",
|
||||
id: sourceId,
|
||||
blockID,
|
||||
}], [{
|
||||
action: "sortAttrViewCol",
|
||||
avID,
|
||||
previousID: sourceElement.previousElementSibling?.getAttribute("data-id") || "",
|
||||
id: sourceId,
|
||||
blockID
|
||||
}]);
|
||||
let column: IAVColumn;
|
||||
data.view.columns.find((item, index: number) => {
|
||||
if (item.id === sourceId) {
|
||||
column = data.view.columns.splice(index, 1)[0];
|
||||
return true;
|
||||
if (targetElement.getAttribute("data-type") === "editCol") {
|
||||
const previousID = (targetElement.classList.contains("dragover__top") ? targetElement.previousElementSibling?.getAttribute("data-id") : targetElement.getAttribute("data-id")) || ""
|
||||
const undoPreviousID = sourceElement.previousElementSibling?.getAttribute("data-id") || "";
|
||||
if (previousID !== undoPreviousID && previousID !== sourceId) {
|
||||
transaction(options.protyle, [{
|
||||
action: "sortAttrViewCol",
|
||||
avID,
|
||||
previousID,
|
||||
id: sourceId,
|
||||
blockID,
|
||||
}], [{
|
||||
action: "sortAttrViewCol",
|
||||
avID,
|
||||
previousID: undoPreviousID,
|
||||
id: sourceId,
|
||||
blockID
|
||||
}]);
|
||||
let column: IAVColumn;
|
||||
data.view.columns.find((item, index: number) => {
|
||||
if (item.id === sourceId) {
|
||||
column = data.view.columns.splice(index, 1)[0];
|
||||
return true;
|
||||
}
|
||||
});
|
||||
data.view.columns.find((item, index: number) => {
|
||||
if (item.id === targetId) {
|
||||
if (isTop) {
|
||||
data.view.columns.splice(index, 0, column);
|
||||
} else {
|
||||
data.view.columns.splice(index + 1, 0, column);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
data.view.columns.find((item, index: number) => {
|
||||
if (item.id === targetId) {
|
||||
if (isTop) {
|
||||
data.view.columns.splice(index, 0, column);
|
||||
} else {
|
||||
data.view.columns.splice(index + 1, 0, column);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
});
|
||||
menuElement.innerHTML = getPropertiesHTML(data.view);
|
||||
menuElement.innerHTML = getPropertiesHTML(data.view);
|
||||
return;
|
||||
}
|
||||
});
|
||||
let dragoverElement: HTMLElement;
|
||||
avPanelElement.addEventListener("dragover", (event: DragEvent) => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue