fix(editor): events conflicts

This commit is contained in:
Tienson Qin
2020-12-22 16:43:56 +08:00
parent bce559e249
commit b8c5fbec32
3 changed files with 7 additions and 16 deletions

View File

@@ -9,7 +9,8 @@
[cljs-time.core :as t]
[frontend.ui :as ui]
[frontend.commands :as commands]
[clojure.string :as string]))
[clojure.string :as string]
[frontend.mixins :as mixins]))
(defonce default-timestamp-value {:date nil
:time ""

View File

@@ -495,7 +495,7 @@
(let [input-id (state/get-edit-input-id)
input (and input-id (gdom/getElement id))
pos (and input (:pos (util/get-caret-pos input)))]
(when-not (state/get-editor-show-input)
(when (not @commands/*current-command)
(util/stop e)
(let [direction (if (gobj/get e "shiftKey") ; shift+tab move to left
:left
@@ -596,19 +596,8 @@
(let [matched-commands (editor-handler/get-matched-commands input)]
(if (seq matched-commands)
(do
(cond
(= key-code 9) ;tab
(when @*show-commands
(util/stop e)
(editor-handler/insert-command! input-id
(last (first matched-commands))
format
nil))
:else
(do
(reset! *show-commands true)
(reset! *matched-commands matched-commands))))
(reset! *show-commands true)
(reset! *matched-commands matched-commands))
(reset! *show-commands false))))
(when (and @*show-block-commands (not= key-code 188)) ; not <
(let [matched-block-commands (editor-handler/get-matched-block-commands input)]

View File

@@ -221,7 +221,8 @@
(when-not (input-or-select?)
(swap! *internal-model inc-week 1)))}
{:all-handler (fn [e key-code]
(when (contains? #{13} key-code)
(when (and (contains? #{13 37 39 38 40} key-code)
(not deadline-or-schedule?))
(util/stop e)))}))))
{:init (fn [state]
(reset! *internal-model (first (:rum/args state)))