Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: https://github.com/siyuan-note/siyuan/issues/15562

Vanessa8739ae562504
diff --git a/app/src/protyle/gutter/index.ts b/app/src/protyle/gutter/index.ts
index 0a4f55c2f0..40c7c48430 100644
--- a/app/src/protyle/gutter/index.ts
+++ b/app/src/protyle/gutter/index.ts
@@ -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;
}
diff --git a/app/src/protyle/util/editorCommonEvent.ts b/app/src/protyle/util/editorCommonEvent.ts
index 00993c2abe..8acd3afd6f 100644
--- a/app/src/protyle/util/editorCommonEvent.ts
+++ b/app/src/protyle/util/editorCommonEvent.ts
@@ -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,