From b75be56ac0f85ca407a68d051356093ddc644b35 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Sat, 30 Jul 2022 23:35:40 +0800 Subject: [PATCH] :lipstick: fix https://github.com/siyuan-note/siyuan/issues/5499 --- app/src/asset/anno.ts | 4 ++-- app/src/block/popover.ts | 3 ++- app/src/protyle/wysiwyg/index.ts | 4 ++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/app/src/asset/anno.ts b/app/src/asset/anno.ts index 207bbfafd..bd446ef75 100644 --- a/app/src/asset/anno.ts +++ b/app/src/asset/anno.ts @@ -267,9 +267,9 @@ let rectElement: HTMLElement; const showToolbar = (element: HTMLElement, range: Range, target?: HTMLElement) => { if (target) { // 阻止 popover - target.classList.remove("popover__block"); + target.setAttribute("prevent-popover", "true"); setTimeout(() => { - target.classList.add("popover__block"); + target.removeAttribute("prevent-popover"); }, 620); } diff --git a/app/src/block/popover.ts b/app/src/block/popover.ts index beda414d0..c44121540 100644 --- a/app/src/block/popover.ts +++ b/app/src/block/popover.ts @@ -106,7 +106,8 @@ export const initBlockPopover = () => { if (!popoverTargetElement && aElement && aElement.getAttribute("data-href")?.startsWith("siyuan://blocks") && aElement.getAttribute("prevent-popover") !== "true") { popoverTargetElement = aElement; } - if (!popoverTargetElement || window.siyuan.altIsPressed || window.siyuan.shiftIsPressed || window.siyuan.ctrlIsPressed) { + if (!popoverTargetElement || window.siyuan.altIsPressed || window.siyuan.shiftIsPressed || window.siyuan.ctrlIsPressed || + (popoverTargetElement && popoverTargetElement.getAttribute("prevent-popover") === "true")) { return; } // https://github.com/siyuan-note/siyuan/issues/4314 diff --git a/app/src/protyle/wysiwyg/index.ts b/app/src/protyle/wysiwyg/index.ts index c975e4c8d..99fce3299 100644 --- a/app/src/protyle/wysiwyg/index.ts +++ b/app/src/protyle/wysiwyg/index.ts @@ -452,9 +452,9 @@ export class WYSIWYG { const rect = target.getBoundingClientRect(); setPosition(window.siyuan.menus.menu.element, rect.left, rect.top + 13, 26); // 阻止 popover - target.removeAttribute("data-type"); + target.setAttribute("prevent-popover", "true"); setTimeout(() => { - target.setAttribute("data-type", "block-ref"); + target.removeAttribute("prevent-popover"); }, 620); return false; }