mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-03-11 23:22:33 +01:00
This commit is contained in:
parent
f8c6cacf22
commit
4be64ed121
10 changed files with 22 additions and 6 deletions
|
|
@ -45,6 +45,14 @@ export const avClick = (protyle: IProtyle, event: MouseEvent & { target: HTMLEle
|
|||
return true;
|
||||
}
|
||||
|
||||
const gutterElement = hasClosestByClassName(event.target, "av__gutters");
|
||||
if (gutterElement) {
|
||||
avContextmenu(protyle, event, gutterElement);
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
return true;
|
||||
}
|
||||
|
||||
const checkElement = hasClosestByClassName(event.target, "av__firstcol");
|
||||
if (checkElement) {
|
||||
// TODO
|
||||
|
|
@ -72,6 +80,9 @@ export const avContextmenu = (protyle: IProtyle, event: MouseEvent & { detail: a
|
|||
if (!rowElement) {
|
||||
return false;
|
||||
}
|
||||
if (rowElement.classList.contains("av__row--header")) {
|
||||
return false
|
||||
}
|
||||
const blockElement = hasClosestBlock(rowElement);
|
||||
if (!blockElement) {
|
||||
return false;
|
||||
|
|
@ -83,7 +94,7 @@ export const avContextmenu = (protyle: IProtyle, event: MouseEvent & { detail: a
|
|||
item.classList.remove("av__row--select");
|
||||
});
|
||||
const rowId = rowElement.getAttribute("data-id");
|
||||
const menu = new Menu("av-row");
|
||||
const menu = new Menu();
|
||||
if (menu.isOpen) {
|
||||
return true;
|
||||
}
|
||||
|
|
@ -101,7 +112,7 @@ export const avContextmenu = (protyle: IProtyle, event: MouseEvent & { detail: a
|
|||
click() {
|
||||
transaction(protyle, [{
|
||||
action: "removeAttrViewBlock",
|
||||
srcIDs: [rowId],
|
||||
srcIDs: [rowElement.querySelector(".av__cell").getAttribute("data-block-id")],
|
||||
parentID: blockElement.getAttribute("data-av-id"),
|
||||
}], [{
|
||||
action: "insertAttrViewBlock",
|
||||
|
|
|
|||
|
|
@ -43,12 +43,12 @@ export const avRender = (element: Element, cb?: () => void) => {
|
|||
// body
|
||||
data.rows.forEach((row: IAVRow) => {
|
||||
tableHTML += `<div class="av__row" data-id="${row.id}">
|
||||
<div class="av__gutters">
|
||||
<div class="av__gutters" data-position="right" aria-label="${window.siyuan.languages.rowTip}">
|
||||
<button><svg><use xlink:href="#iconLine"></use></svg></button>
|
||||
</div>
|
||||
<div class="av__firstcol"><svg><use xlink:href="#iconUncheck"></use></svg></div>`;
|
||||
row.cells.forEach((cell, index) => {
|
||||
tableHTML += `<div class="av__cell" data-index="${index}" style="width: ${data.columns[index].width || 200}px;${cell.bgColor ? `background-color:${cell.bgColor};` : ""}${cell.color ? `color:${cell.color};` : ""}">${cell.renderValue?.content || ""}</div>`;
|
||||
tableHTML += `<div class="av__cell" data-block-id="${cell.renderValue?.id || ""}" data-index="${index}" style="width: ${data.columns[index].width || 200}px;${cell.bgColor ? `background-color:${cell.bgColor};` : ""}${cell.color ? `color:${cell.color};` : ""}">${cell.renderValue?.content || ""}</div>`;
|
||||
});
|
||||
tableHTML += "<div></div></div>";
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue