mirror of https://github.com/logseq/logseq
Close action menu when pressing escape
parent
d39ae199fb
commit
bc00dba369
|
@ -2874,7 +2874,7 @@
|
||||||
(when (and (not editor-action) (not non-enter-processed?))
|
(when (and (not editor-action) (not non-enter-processed?))
|
||||||
(cond
|
(cond
|
||||||
;; When you type text inside square brackets
|
;; When you type text inside square brackets
|
||||||
(and (not (contains? #{"ArrowDown" "ArrowLeft" "ArrowRight" "ArrowUp"} k))
|
(and (not (contains? #{"ArrowDown" "ArrowLeft" "ArrowRight" "ArrowUp" "Escape"} k))
|
||||||
(wrapped-by? input page-ref/left-brackets page-ref/right-brackets))
|
(wrapped-by? input page-ref/left-brackets page-ref/right-brackets))
|
||||||
(let [orig-pos (cursor/get-caret-pos input)
|
(let [orig-pos (cursor/get-caret-pos input)
|
||||||
value (gobj/get input "value")
|
value (gobj/get input "value")
|
||||||
|
|
|
@ -14,8 +14,14 @@
|
||||||
:on-hide
|
:on-hide
|
||||||
(fn [_state e event]
|
(fn [_state e event]
|
||||||
(let [target (.-target e)]
|
(let [target (.-target e)]
|
||||||
(if (d/has-class? target "bottom-action") ;; FIXME: not particular case
|
(cond
|
||||||
|
(state/get-editor-action)
|
||||||
|
(state/clear-editor-action!) ;; FIXME: This should probably be handled as a keydown handler in editor, but this handler intercepts Esc first
|
||||||
|
|
||||||
|
(d/has-class? target "bottom-action") ;; FIXME: not particular case
|
||||||
(.preventDefault e)
|
(.preventDefault e)
|
||||||
|
|
||||||
|
:else
|
||||||
(let [{:keys [on-hide value]} (editor-handler/get-state)]
|
(let [{:keys [on-hide value]} (editor-handler/get-state)]
|
||||||
(when on-hide
|
(when on-hide
|
||||||
(on-hide value event))
|
(on-hide value event))
|
||||||
|
|
Loading…
Reference in New Issue