Browse Source

fix: Delete key is deleting 2 characters rather than 1

close #3191
Tienson Qin 4 years ago
parent
commit
63a1050743

+ 1 - 0
src/main/frontend/handler/editor.cljs

@@ -3126,6 +3126,7 @@
 (defn editor-delete
   [_state e]
   (when (state/editing?)
+    (util/stop e)
     (keydown-delete-handler e)))
 
 (defn editor-backspace

+ 1 - 1
src/main/frontend/modules/shortcut/core.cljs

@@ -25,7 +25,7 @@
 
 (defn- get-handler-by-id
   [handler-id]
-  (-> (some #(= (:group %) handler-id) (vals @*installed))
+  (-> (filter #(= (:group %) handler-id) (vals @*installed))
       first
       :handler))
 

+ 1 - 0
src/main/frontend/state.cljs

@@ -489,6 +489,7 @@
 (defn set-edit-content!
   ([input-id value] (set-edit-content! input-id value true))
   ([input-id value set-input-value?]
+   (prn "set edit content: " value)
    (when input-id
      (when set-input-value?
        (when-let [input (gdom/getElement input-id)]