Skip to content

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

:art: https://ld246.com/article/1679618995926

Vanessa0aed3a257af8
diff --git a/app/src/util/globalShortcut.ts b/app/src/util/globalShortcut.ts
index 954214834a..e0d1349e15 100644
--- a/app/src/util/globalShortcut.ts
+++ b/app/src/util/globalShortcut.ts
@@ -361,11 +361,8 @@ export const globalShortcut = () => {
const currentType = currentLiElement.getAttribute("data-type") as TDockType;
if (currentType) {
getDockByType(currentType).toggleModel(currentType, true);
- const target = event.target as HTMLElement;
- if (target.classList.contains("protyle-wysiwyg") ||
- target.classList.contains("protyle-title__input") ||
- target.tagName === "INPUT" || target.tagName === "TEXTAREA") {
- target.blur();
+ if (document.activeElement) {
+ (document.activeElement as HTMLElement).blur();
}
} else {
const currentId = currentLiElement.getAttribute("data-id");
@@ -613,10 +610,8 @@ export const globalShortcut = () => {
const matchDock = getAllDocks().find(item => {
if (matchHotKey(window.siyuan.config.keymap.general[item.hotkeyLangId].custom, event)) {
getDockByType(item.type).toggleModel(item.type);
- if (target.classList.contains("protyle-wysiwyg") ||
- target.classList.contains("protyle-title__input") ||
- target.tagName === "INPUT" || target.tagName === "TEXTAREA") {
- target.blur();
+ if (document.activeElement) {
+ (document.activeElement as HTMLElement).blur();
}
event.preventDefault();
return true;
@@ -627,23 +622,18 @@ export const globalShortcut = () => {
}
if (matchHotKey(window.siyuan.config.keymap.general.riffCard.custom, event)) {
openCard();
- if (target.classList.contains("protyle-wysiwyg") ||
- target.tagName === "TABLE" ||
- target.classList.contains("protyle-title__input") ||
- target.tagName === "INPUT" || target.tagName === "TEXTAREA") {
- target.blur();
+ if (document.activeElement) {
+ (document.activeElement as HTMLElement).blur();
}
event.preventDefault();
return;
}
if (!isTabWindow && matchHotKey(window.siyuan.config.keymap.general.dailyNote.custom, event)) {
newDailyNote();
- if (target.classList.contains("protyle-wysiwyg") ||
- target.tagName === "TABLE" ||
- target.classList.contains("protyle-title__input") ||
- target.tagName === "INPUT" || target.tagName === "TEXTAREA") {
- target.blur();
+ if (document.activeElement) {
+ (document.activeElement as HTMLElement).blur();
}
+ event.stopPropagation();
event.preventDefault();
return;
}