Vanessa 2023-12-20 22:23:30 +08:00
parent aa2f05dcb5
commit 520c2aec7d
6 changed files with 63 additions and 85 deletions

View file

@ -159,39 +159,6 @@ export const avClick = (protyle: IProtyle, event: MouseEvent & { target: HTMLEle
event.preventDefault();
event.stopPropagation();
return true;
} else if (target.classList.contains("av__gutter")) {
const rowElement = hasClosestByClassName(target, "av__row");
if (!rowElement) {
return;
}
if (target.dataset.action === "add") {
const avID = blockElement.getAttribute("data-av-id");
const srcIDs = [Lute.NewNodeID()];
const previousID = event.altKey ? (rowElement.previousElementSibling.getAttribute("data-id") || "") : rowElement.getAttribute("data-id");
transaction(protyle, [{
action: "insertAttrViewBlock",
avID,
previousID,
srcIDs,
isDetached: true,
}], [{
action: "removeAttrViewBlock",
srcIDs,
avID,
}]);
insertAttrViewBlockAnimation(blockElement, srcIDs, previousID, avID);
} else {
const gutterRect = target.getBoundingClientRect();
avContextmenu(protyle, rowElement, {
x: gutterRect.left,
y: gutterRect.bottom,
w: gutterRect.width,
h: gutterRect.height
});
}
event.preventDefault();
event.stopPropagation();
return true;
} else if (target.classList.contains("av__firstcol")) {
window.siyuan.menus.menu.remove();
selectRow(target, "toggle");

View file

@ -120,11 +120,7 @@ style="width: ${column.width || "200px"}">${getCalcValue(column) || '<svg><use x
</div>`;
// body
data.rows.forEach((row: IAVRow) => {
tableHTML += `<div class="av__row" data-id="${row.id}">
<div class="av__gutters">
<button class="av__gutter ariaLabel" data-action="add" data-position="right" aria-label="${isMac() ? window.siyuan.languages.addBelowAbove : window.siyuan.languages.addBelowAbove.replace("", "Alt+")}"><svg><use xlink:href="#iconAdd"></use></svg></button>
<button class="av__gutter ariaLabel" draggable="true" data-position="right" aria-label="${window.siyuan.languages.rowTip}"><svg><use xlink:href="#iconDrag"></use></svg></button>
</div>`;
tableHTML += `<div class="av__row" data-id="${row.id}">`;
if (pinIndex > -1) {
tableHTML += '<div class="av__colsticky"><div class="av__firstcol"><svg><use xlink:href="#iconUncheck"></use></svg></div>';
} else {