From f8b7d1539b3b5f260599bdfb5a33aeca4e60dec6 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Wed, 2 Aug 2023 15:19:56 +0800 Subject: [PATCH] =?UTF-8?q?:bug:=20https://github.com/siyuan-note/insider/?= =?UTF-8?q?issues/1114=20=E9=80=89=E6=8B=A9=E5=B1=9E=E6=80=A7=E6=8E=92?= =?UTF-8?q?=E5=BA=8F=E6=97=A0=E6=95=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/protyle/render/av/openMenuPanel.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/src/protyle/render/av/openMenuPanel.ts b/app/src/protyle/render/av/openMenuPanel.ts index 4107ed64e..3a95bd385 100644 --- a/app/src/protyle/render/av/openMenuPanel.ts +++ b/app/src/protyle/render/av/openMenuPanel.ts @@ -102,7 +102,7 @@ export const openMenuPanel = (options: { } else if (targetElement.querySelector('[data-type="removeFilter"]')) { type = "filters"; } else if (targetElement.querySelector('[data-type="setColOption"]')) { - const colId = options.cellElements ? options.cellElements[0].dataset.colId : menuElement.firstElementChild.getAttribute("data-col-id"); + const colId = options.cellElements ? options.cellElements[0].dataset.colId : menuElement.querySelector(".b3-menu__item").getAttribute("data-col-id"); const changeData = data.view.columns.find((column) => column.id === colId).options; const oldData = Object.assign([], changeData); let targetOption: { name: string, color: string }; @@ -510,7 +510,7 @@ export const openMenuPanel = (options: { break; } else if (type === "hideCol") { const isEdit = menuElement.querySelector('[data-type="goProperties"]'); - const colId = isEdit ? menuElement.firstElementChild.getAttribute("data-col-id") : target.parentElement.getAttribute("data-id"); + const colId = isEdit ? menuElement.querySelector(".b3-menu__item").getAttribute("data-col-id") : target.parentElement.getAttribute("data-id"); transaction(options.protyle, [{ action: "setAttrViewColHidden", id: colId, @@ -539,7 +539,7 @@ export const openMenuPanel = (options: { break; } else if (type === "showCol") { const isEdit = menuElement.querySelector('[data-type="goProperties"]'); - const colId = isEdit ? menuElement.firstElementChild.getAttribute("data-col-id") : target.parentElement.getAttribute("data-id"); + const colId = isEdit ? menuElement.querySelector(".b3-menu__item").getAttribute("data-col-id") : target.parentElement.getAttribute("data-id"); transaction(options.protyle, [{ action: "setAttrViewColHidden", id: colId, @@ -567,7 +567,7 @@ export const openMenuPanel = (options: { event.stopPropagation(); break; } else if (type === "duplicateCol") { - const colId = menuElement.firstElementChild.getAttribute("data-col-id"); + const colId = menuElement.querySelector(".b3-menu__item").getAttribute("data-col-id"); const colData = data.view.columns.find((item: IAVColumn) => item.id === colId); duplicateCol({ protyle: options.protyle, @@ -582,7 +582,7 @@ export const openMenuPanel = (options: { event.stopPropagation(); break; } else if (type === "removeCol") { - const colId = menuElement.firstElementChild.getAttribute("data-col-id"); + const colId = menuElement.querySelector(".b3-menu__item").getAttribute("data-col-id"); const colData = data.view.columns.find((item: IAVColumn) => item.id === colId); transaction(options.protyle, [{ action: "removeAttrViewCol",