This commit is contained in:
parent
a3e6b69280
commit
6f58d1387f
1 changed files with 19 additions and 7 deletions
|
@ -278,13 +278,25 @@ export const avContextmenu = (protyle: IProtyle, event: MouseEvent & { detail: a
|
|||
menu.addSeparator();
|
||||
const editAttrSubmenu: IMenu[] = [];
|
||||
rowElement.parentElement.querySelectorAll(".av__row--header .av__cell").forEach((cellElement: HTMLElement) => {
|
||||
editAttrSubmenu.push({
|
||||
icon: getColIconByType(cellElement.getAttribute("data-dtype") as TAVCol),
|
||||
label: cellElement.textContent.trim(),
|
||||
click() {
|
||||
popTextCell(protyle, Array.from(blockElement.querySelectorAll(`.av__row--select:not(.av__row--header) .av__cell[data-col-id="${cellElement.dataset.colId}"]`)));
|
||||
}
|
||||
});
|
||||
let hideBlock = false
|
||||
const selectElements: HTMLElement[] = Array.from(blockElement.querySelectorAll(`.av__row--select:not(.av__row--header) .av__cell[data-col-id="${cellElement.dataset.colId}"]`))
|
||||
if (cellElement.dataset.dtype === "block") {
|
||||
selectElements.find(item => {
|
||||
if (!item.dataset.detached) {
|
||||
hideBlock = true;
|
||||
return true;
|
||||
}
|
||||
})
|
||||
}
|
||||
if (!hideBlock) {
|
||||
editAttrSubmenu.push({
|
||||
icon: getColIconByType(cellElement.getAttribute("data-dtype") as TAVCol),
|
||||
label: cellElement.textContent.trim(),
|
||||
click() {
|
||||
popTextCell(protyle, selectElements);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
menu.addItem({
|
||||
icon: "iconAttr",
|
||||
|
|
Loading…
Add table
Reference in a new issue