Explorar o código

fix(api): safety key string for the simple command key value

charlie %!s(int64=2) %!d(string=hai) anos
pai
achega
3934efb537
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  1. 1 1
      src/main/logseq/api.cljs

+ 1 - 1
src/main/logseq/api.cljs

@@ -349,7 +349,7 @@
   (fn [pid ^js cmd-action palette?]
     (when-let [[cmd action] (bean/->clj cmd-action)]
       (let [action      (assoc action 0 (keyword (first action)))
-            cmd         (assoc cmd :key (string/replace (:key cmd) ":" "-"))
+            cmd         (assoc cmd :key (-> (:key cmd) (string/trim) (string/replace ":" "-") (string/replace #"^([0-9])" "_$1")))
             key         (:key cmd)
             keybinding  (:keybinding cmd)
             palette-cmd (plugin-handler/simple-cmd->palette-cmd pid cmd action)