Skip to content

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

:technologist: Make hotkey optional for plugin commands (#16676)

Jeffrey Chena02c616f22ac
diff --git a/app/src/plugin/index.ts b/app/src/plugin/index.ts
index 7ec87cefe1..a6a2d0879b 100644
--- a/app/src/plugin/index.ts
+++ b/app/src/plugin/index.ts
@@ -136,6 +136,9 @@ export class Plugin {
}
public addCommand(command: ICommand) {
+ if (typeof command.hotkey !== "string") {
+ command.hotkey = "";
+ }
if (!window.siyuan.config.keymap.plugin) {
window.siyuan.config.keymap.plugin = {};
}
diff --git a/app/src/types/index.d.ts b/app/src/types/index.d.ts
index 1cfa54c618..4002207adf 100644
--- a/app/src/types/index.d.ts
+++ b/app/src/types/index.d.ts
@@ -619,9 +619,9 @@ interface ILayoutJSON extends ILayoutOptions {
interface ICommand {
langKey: string, // 用于区分不同快捷键的 key, 同时作为 i18n 的字段名
langText?: string, // 显示的文本, 指定后不再使用 langKey 对应的 i18n 文本
- hotkey: string,
+ hotkey?: string, // 快捷键,默认为空字符串
customHotkey?: string,
- callback?: () => void // 其余回调存在时将不会触
+ callback?: () => void // 其余回调存在时将不会触发
globalCallback?: () => void // 焦点不在应用内时执行的回调
fileTreeCallback?: (file: import("../layout/dock/Files").Files) => void // 焦点在文档树上时执行的回调
editorCallback?: (protyle: IProtyle) => void // 焦点在编辑器上时执行的回调