From 6f58d1387fe3133b7e7a613b4dbf5d40f482dcbb Mon Sep 17 00:00:00 2001 From: Vanessa Date: Sun, 8 Oct 2023 09:38:39 +0800 Subject: [PATCH] :art: https://github.com/siyuan-note/siyuan/issues/9274 --- app/src/protyle/render/av/action.ts | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/app/src/protyle/render/av/action.ts b/app/src/protyle/render/av/action.ts index 72662e23c..334e54488 100644 --- a/app/src/protyle/render/av/action.ts +++ b/app/src/protyle/render/av/action.ts @@ -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",