Browse Source

:art: plugin

Vanessa 8 months ago
parent
commit
a96da3dff0
1 changed files with 6 additions and 2 deletions
  1. 6 2
      app/src/protyle/toolbar/index.ts

+ 6 - 2
app/src/protyle/toolbar/index.ts

@@ -74,7 +74,9 @@ export class Toolbar {
                 if (typeof toolbarItem === "string" || Constants.INLINE_TYPE.concat("|").includes(toolbarItem.name) || !toolbarItem.hotkey) {
                 if (typeof toolbarItem === "string" || Constants.INLINE_TYPE.concat("|").includes(toolbarItem.name) || !toolbarItem.hotkey) {
                     return
                     return
                 }
                 }
-                toolbarItem.hotkey = window.siyuan.config.keymap.plugin[item.name][toolbarItem.name].custom;
+                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;
+                }
             })
             })
             options.toolbar = toolbarKeyToMenu(pluginToolbar);
             options.toolbar = toolbarKeyToMenu(pluginToolbar);
         });
         });
@@ -93,7 +95,9 @@ export class Toolbar {
                 if (typeof toolbarItem === "string" || Constants.INLINE_TYPE.concat("|").includes(toolbarItem.name) || !toolbarItem.hotkey) {
                 if (typeof toolbarItem === "string" || Constants.INLINE_TYPE.concat("|").includes(toolbarItem.name) || !toolbarItem.hotkey) {
                     return
                     return
                 }
                 }
-                toolbarItem.hotkey = window.siyuan.config.keymap.plugin[item.name][toolbarItem.name].custom;
+                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;
+                }
             })
             })
             protyle.options.toolbar = toolbarKeyToMenu(pluginToolbar);
             protyle.options.toolbar = toolbarKeyToMenu(pluginToolbar);
         });
         });