Kaynağa Gözat

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

charlie 2 yıl önce
ebeveyn
işleme
3934efb537
1 değiştirilmiş dosya ile 1 ekleme ve 1 silme
  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)