Skip to content

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

:art: https://github.com/siyuan-note/siyuan/pull/16676

Vanessa8520b02df579
diff --git a/app/src/config/keymap.ts b/app/src/config/keymap.ts
index 0f79661b74..79ef5b0427 100644
--- a/app/src/config/keymap.ts
+++ b/app/src/config/keymap.ts
@@ -56,9 +56,12 @@ export const keymap = {
</label>`;
});
item.updateProtyleToolbar([]).forEach(toolbarItem => {
- if (typeof toolbarItem === "string" || Constants.INLINE_TYPE.concat("|").includes(toolbarItem.name) || !toolbarItem.hotkey) {
+ if (typeof toolbarItem === "string" || Constants.INLINE_TYPE.concat("|").includes(toolbarItem.name)) {
return;
}
+ if (typeof toolbarItem.hotkey !== "string") {
+ toolbarItem.hotkey = "";
+ }
const dockKeymap = window.siyuan.config.keymap.plugin[item.name][toolbarItem.name];
const keyValue = updateHotkeyTip(dockKeymap.custom);
commandHTML += `<label class="b3-list-item b3-list-item--narrow b3-list-item--hide-action">
diff --git a/app/src/plugin/index.ts b/app/src/plugin/index.ts
index a6a2d0879b..2b7dd8cf22 100644
--- a/app/src/plugin/index.ts
+++ b/app/src/plugin/index.ts
@@ -80,9 +80,12 @@ export class Plugin {
});
this.updateProtyleToolbar([]).forEach(toolbarItem => {
- if (typeof toolbarItem === "string" || Constants.INLINE_TYPE.concat("|").includes(toolbarItem.name) || !toolbarItem.hotkey) {
+ if (typeof toolbarItem === "string" || Constants.INLINE_TYPE.concat("|").includes(toolbarItem.name)) {
return;
}
+ if (typeof toolbarItem.hotkey !== "string") {
+ toolbarItem.hotkey = "";
+ }
if (!window.siyuan.config.keymap.plugin) {
window.siyuan.config.keymap.plugin = {};
}
@@ -99,6 +102,8 @@ export class Plugin {
default: toolbarItem.hotkey,
custom: toolbarItem.hotkey,
};
+ } else {
+ window.siyuan.config.keymap.plugin[options.name][toolbarItem.name].default = toolbarItem.hotkey;
}
});
}
diff --git a/app/src/protyle/toolbar/index.ts b/app/src/protyle/toolbar/index.ts
index 7998617e60..67a592d720 100644
--- a/app/src/protyle/toolbar/index.ts
+++ b/app/src/protyle/toolbar/index.ts
@@ -69,9 +69,12 @@ export class Toolbar {
protyle.app.plugins.forEach(item => {
const pluginToolbar = item.updateProtyleToolbar(options.toolbar);
pluginToolbar.forEach(toolbarItem => {
- if (typeof toolbarItem === "string" || Constants.INLINE_TYPE.concat("|").includes(toolbarItem.name) || !toolbarItem.hotkey) {
+ if (typeof toolbarItem === "string" || Constants.INLINE_TYPE.concat("|").includes(toolbarItem.name)) {
return;
}
+ if (typeof toolbarItem.hotkey !== "string") {
+ toolbarItem.hotkey = "";
+ }
if (window.siyuan.config.keymap.plugin && window.siyuan.config.keymap.plugin[item.name] && window.siyuan.config.keymap.plugin[item.name][toolbarItem.name]) {
toolbarItem.hotkey = window.siyuan.config.keymap.plugin[item.name][toolbarItem.name].custom;
}
@@ -90,9 +93,12 @@ export class Toolbar {
protyle.app.plugins.forEach(item => {
const pluginToolbar = item.updateProtyleToolbar(protyle.options.toolbar);
pluginToolbar.forEach(toolbarItem => {
- if (typeof toolbarItem === "string" || Constants.INLINE_TYPE.concat("|").includes(toolbarItem.name) || !toolbarItem.hotkey) {
+ if (typeof toolbarItem === "string" || Constants.INLINE_TYPE.concat("|").includes(toolbarItem.name)) {
return;
}
+ if (typeof toolbarItem.hotkey !== "string") {
+ toolbarItem.hotkey = "";
+ }
if (window.siyuan.config.keymap.plugin && window.siyuan.config.keymap.plugin[item.name] && window.siyuan.config.keymap.plugin[item.name][toolbarItem.name]) {
toolbarItem.hotkey = window.siyuan.config.keymap.plugin[item.name][toolbarItem.name].custom;
}