Skip to content

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

:bug: Toggle the Command Palette with its shortcut https://github.com/siyuan-note/siyuan/issues/15448

Daniel1628aa5e8a30
diff --git a/app/src/boot/globalEvent/command/panel.ts b/app/src/boot/globalEvent/command/panel.ts
index f7dac2a00e..30eb70fcae 100644
--- a/app/src/boot/globalEvent/command/panel.ts
+++ b/app/src/boot/globalEvent/command/panel.ts
@@ -24,8 +24,15 @@ import {getDisplayName, getNotebookName, getTopPaths, movePathTo, moveToPath, pa
import {hintMoveBlock} from "../../../protyle/hint/extend";
import {fetchSyncPost} from "../../../util/fetch";
import {focusByRange} from "../../../protyle/util/selection";
+import {matchHotKey} from "../../../protyle/util/hotKey";
export const commandPanel = (app: App) => {
+ const openCommandPanelDialog = window.siyuan.dialogs.find(item =>
+ item.element.getAttribute("data-key") === Constants.DIALOG_COMMANDPANEL);
+ if (openCommandPanelDialog) {
+ openCommandPanelDialog.destroy();
+ return;
+ }
const range = getSelection().rangeCount > 0 ? getSelection().getRangeAt(0) : undefined;
const dialog = new Dialog({
width: isMobile() ? "92vw" : "80vw",
@@ -127,6 +134,11 @@ export const commandPanel = (app: App) => {
if (event.isComposing) {
return;
}
+ if (!event.repeat && matchHotKey(window.siyuan.config.keymap.general.commandPanel.custom, event)) {
+ dialog.destroy();
+ event.preventDefault();
+ return;
+ }
upDownHint(listElement, event);
if (event.key === "Enter") {
const currentElement = listElement.querySelector(".b3-list-item--focus");