fix(ui): page of all shortcuts crashed when parse unsupported binding keyname

pull/5244/head
charlie 2022-05-06 17:36:43 +08:00 committed by Tienson Qin
parent f18277801c
commit e8e6e48b77
1 changed files with 6 additions and 2 deletions

View File

@ -150,9 +150,13 @@
false
(let [handler-id (get-group k)
shortcut-m (shortcut-map handler-id)
parse-shortcut #(try
(KeyboardShortcutHandler/parseStringShortcut %)
(catch js/Error e
(js/console.error "[shortcut/parse-error]" (str % " - " (.-message e)))))
bindings (->> (shortcut-binding k)
(map mod-key)
(map KeyboardShortcutHandler/parseStringShortcut)
(map parse-shortcut)
(map js->clj))
rest-bindings (->> (map key shortcut-m)
(remove #{k})
@ -160,7 +164,7 @@
(filter vector?)
(mapcat identity)
(map mod-key)
(map KeyboardShortcutHandler/parseStringShortcut)
(map parse-shortcut)
(map js->clj))]
(some? (some (fn [b] (some #{b} rest-bindings)) bindings)))))