Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: fix https://github.com/siyuan-note/siyuan/issues/5122

Vanessa0c7e5e8667e4
diff --git a/app/src/util/globalShortcut.ts b/app/src/util/globalShortcut.ts
index 2920f31840..7279bd54e9 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 => {