From 0c7e5e8667e4d0345fab49bb748e46367debec4a Mon Sep 17 00:00:00 2001 From: Vanessa Date: Tue, 7 Jun 2022 20:23:04 +0800 Subject: [PATCH] :art: fix https://github.com/siyuan-note/siyuan/issues/5122 --- app/src/util/globalShortcut.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/src/util/globalShortcut.ts b/app/src/util/globalShortcut.ts index 2920f3184..7279bd54e 100644 --- a/app/src/util/globalShortcut.ts +++ b/app/src/util/globalShortcut.ts @@ -498,7 +498,11 @@ export const globalShortcut = () => { window.addEventListener("click", (event: MouseEvent & { target: HTMLElement }) => { if (!window.siyuan.menus.menu.element.contains(event.target) && !hasClosestByAttribute(event.target, "data-menu", "true")) { - window.siyuan.menus.menu.remove(); + if (getSelection().rangeCount > 0 && window.siyuan.menus.menu.element.contains(getSelection().getRangeAt(0).startContainer)) { + // https://ld246.com/article/1654567749834/comment/1654589171218#comments + } else { + window.siyuan.menus.menu.remove(); + } } if (!hasClosestByClassName(event.target, "pdf__outer")) { document.querySelectorAll(".pdf__util").forEach(item => {