fix: ESC doesn't exit editor after page autocomplete

experiment/tanstack-table
Tienson Qin 2024-06-18 05:32:44 +08:00
parent 0bd6c05e69
commit a39f19c976
1 changed files with 7 additions and 1 deletions

View File

@ -855,7 +855,8 @@
(mixins/hide-when-esc-or-outside
state
:on-hide (fn [_state e type]
(editor-on-hide state (:value (editor-handler/get-state)) type e)))))
(when (not= type :esc)
(editor-on-hide state (:value (editor-handler/get-state)) type e))))))
(mixins/event-mixin setup-key-listener!)
lifecycle/lifecycle
[state {:keys [format block parent-block]} id config]
@ -871,6 +872,11 @@
:on-click (editor-handler/editor-on-click! id)
:on-change (editor-handler/editor-on-change! block id search-timeout)
:on-paste (paste-handler/editor-on-paste! id)
:on-key-down (fn [e]
(if-let [on-key-down (:on-key-down config)]
(on-key-down e)
(when (= (util/ekey e) "Escape")
(editor-on-hide state content :esc e))))
:auto-focus true
:class heading-class}
(some? parent-block)