From 71b1876f487f193c21d986917a52611861719ca6 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Wed, 12 Jun 2024 22:59:06 +0800 Subject: [PATCH] =?UTF-8?q?:bug:=20=E9=80=89=E4=B8=AD=E4=B8=80=E4=B8=AA?= =?UTF-8?q?=E5=9D=97=E5=90=8E=E6=8B=96=E6=8B=BD=E5=8F=A6=E4=B8=80=E4=B8=AA?= =?UTF-8?q?=E5=9D=97=E7=9A=84=E5=9D=97=E6=A0=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/protyle/gutter/index.ts | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/app/src/protyle/gutter/index.ts b/app/src/protyle/gutter/index.ts index 50f309154..9407bdfea 100644 --- a/app/src/protyle/gutter/index.ts +++ b/app/src/protyle/gutter/index.ts @@ -75,7 +75,7 @@ export class Gutter { hideTooltip(); window.siyuan.menus.menu.remove(); const buttonElement = event.target.parentElement; - let selectIds: string[] = []; + const selectIds: string[] = []; let selectElements: Element[] = []; let avElement: Element; if (buttonElement.dataset.rowId) { @@ -90,16 +90,11 @@ export class Gutter { selectElements.push(item); }); } else { - selectIds = [buttonElement.getAttribute("data-node-id")]; + protyle.wysiwyg.element.querySelector(`[data-node-id="${buttonElement.getAttribute("data-node-id")}"]`)?.classList.add("protyle-wysiwyg--select") selectElements = Array.from(protyle.wysiwyg.element.querySelectorAll(".protyle-wysiwyg--select")); - if (selectElements.length > 0) { - selectIds = []; - selectElements.forEach(item => { - selectIds.push(item.getAttribute("data-node-id")); - }); - } else { - selectElements = [protyle.wysiwyg.element.querySelector(`[data-node-id="${selectIds[0]}"]`)]; - } + selectElements.forEach(item => { + selectIds.push(item.getAttribute("data-node-id")); + }); } const ghostElement = document.createElement("div");