mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-09-22 00:20:47 +02:00
This commit is contained in:
parent
085c72add5
commit
8739ae5625
2 changed files with 12 additions and 10 deletions
|
@ -100,8 +100,7 @@ export class Gutter {
|
|||
event.stopPropagation();
|
||||
return;
|
||||
}
|
||||
|
||||
const rowElement = avElement.querySelector(`.av__row[data-id="${buttonElement.dataset.rowId}"]`);
|
||||
const rowElement = avElement.querySelector(`.av__body${buttonElement.dataset.groupId ? `[data-group-id="${buttonElement.dataset.groupId}"]` : ""} .av__row[data-id="${buttonElement.dataset.rowId}"]`);
|
||||
if (!rowElement.classList.contains("av__row--select")) {
|
||||
avElement.querySelectorAll(".av__row--select:not(.av__row--header)").forEach(item => {
|
||||
item.classList.remove("av__row--select");
|
||||
|
@ -112,7 +111,8 @@ export class Gutter {
|
|||
rowElement.querySelector(".av__firstcol use").setAttribute("xlink:href", "#iconCheck");
|
||||
updateHeader(rowElement as HTMLElement);
|
||||
avElement.querySelectorAll(".av__row--select:not(.av__row--header)").forEach(item => {
|
||||
selectIds.push(item.getAttribute("data-id"));
|
||||
const groupId = (hasClosestByClassName(item, "av__body") as HTMLElement)?.dataset.groupId || "";
|
||||
selectIds.push(item.getAttribute("data-id") + (groupId ? "@"+groupId : ""));
|
||||
selectElements.push(item);
|
||||
});
|
||||
} else {
|
||||
|
@ -2315,9 +2315,9 @@ export class Gutter {
|
|||
} else if (rowElement.querySelector('[data-dtype="block"]')?.getAttribute("data-detached") === "true") {
|
||||
iconAriaLabel = window.siyuan.languages.rowTip.substring(0, window.siyuan.languages.rowTip.lastIndexOf("<br"));
|
||||
}
|
||||
html = `<button data-type="NodeAttributeViewRowMenu" data-node-id="${dataNodeId}" data-row-id="${rowElement.dataset.id}" data-group-id="${bodyElement.dataset.groupId}" class="ariaLabel" data-position="parentW" aria-label="${iconAriaLabel}"><svg><use xlink:href="#iconDrag"></use></svg><span ${protyle.disabled ? "" : 'draggable="true" class="fn__grab"'}></span></button>`;
|
||||
html = `<button data-type="NodeAttributeViewRowMenu" data-node-id="${dataNodeId}" data-row-id="${rowElement.dataset.id}" data-group-id="${bodyElement.dataset.groupId || ""}" class="ariaLabel" data-position="parentW" aria-label="${iconAriaLabel}"><svg><use xlink:href="#iconDrag"></use></svg><span ${protyle.disabled ? "" : 'draggable="true" class="fn__grab"'}></span></button>`;
|
||||
if (!protyle.disabled) {
|
||||
html = `<button data-type="NodeAttributeViewRow" data-node-id="${dataNodeId}" data-row-id="${rowElement.dataset.id}" data-group-id="${bodyElement.dataset.groupId}" class="ariaLabel" data-position="parentW" aria-label="${isMac() ? window.siyuan.languages.addBelowAbove : window.siyuan.languages.addBelowAbove.replace("⌥", "Alt+")}"><svg><use xlink:href="#iconAdd"></use></svg></button>${html}`;
|
||||
html = `<button data-type="NodeAttributeViewRow" data-node-id="${dataNodeId}" data-row-id="${rowElement.dataset.id}" data-group-id="${bodyElement.dataset.groupId || ""}" class="ariaLabel" data-position="parentW" aria-label="${isMac() ? window.siyuan.languages.addBelowAbove : window.siyuan.languages.addBelowAbove.replace("⌥", "Alt+")}"><svg><use xlink:href="#iconAdd"></use></svg></button>${html}`;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -1093,18 +1093,20 @@ export const dropEvent = (protyle: IProtyle, editorElement: HTMLElement) => {
|
|||
// 行内拖拽
|
||||
const doOperations: IOperation[] = [];
|
||||
const undoOperations: IOperation[] = [];
|
||||
const undoPreviousId = blockElement.querySelector(`.av__row[data-id="${selectedIds[0]}"]`).previousElementSibling.getAttribute("data-id") || "";
|
||||
const targetGroupID = targetElement.parentElement.getAttribute("data-group-id");
|
||||
selectedIds.reverse().forEach(item => {
|
||||
const groupID = blockElement.querySelector(`.av__row[data-id="${item}"]`).parentElement.getAttribute("data-group-id");
|
||||
if (previousID !== item && undoPreviousId !== previousID || (
|
||||
const items = item.split("@");
|
||||
const id = items[0];
|
||||
const groupID = items[1] || "";
|
||||
const undoPreviousId = blockElement.querySelector(`.av__body${groupID ? `[data-group-id="${groupID}"]` : ""} .av__row[data-id="${id}"]`).previousElementSibling.getAttribute("data-id") || "";
|
||||
if (previousID !== id && undoPreviousId !== previousID || (
|
||||
(undoPreviousId === "" && previousID === "" && targetGroupID !== groupID)
|
||||
)) {
|
||||
doOperations.push({
|
||||
action: "sortAttrViewRow",
|
||||
avID,
|
||||
previousID,
|
||||
id: item,
|
||||
id,
|
||||
blockID: blockElement.dataset.nodeId,
|
||||
groupID,
|
||||
targetGroupID,
|
||||
|
@ -1113,7 +1115,7 @@ export const dropEvent = (protyle: IProtyle, editorElement: HTMLElement) => {
|
|||
action: "sortAttrViewRow",
|
||||
avID,
|
||||
previousID: undoPreviousId,
|
||||
id: item,
|
||||
id,
|
||||
blockID: blockElement.dataset.nodeId,
|
||||
groupID: targetGroupID,
|
||||
targetGroupID: groupID,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue