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?))
|
||||
(cond
|
||||
;; 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))
|
||||
(let [orig-pos (cursor/get-caret-pos input)
|
||||
value (gobj/get input "value")
|
||||
|
|
|
@ -14,8 +14,14 @@
|
|||
:on-hide
|
||||
(fn [_state e event]
|
||||
(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)
|
||||
|
||||
:else
|
||||
(let [{:keys [on-hide value]} (editor-handler/get-state)]
|
||||
(when on-hide
|
||||
(on-hide value event))
|
||||
|
|
Loading…
Reference in New Issue