From d5adf85f581f21f4745ddde06bc0efbc2077bd87 Mon Sep 17 00:00:00 2001 From: Tienson Qin Date: Mon, 15 Aug 2022 18:48:25 +0800 Subject: [PATCH] fix: lint warnings --- .../frontend/handler/editor/keyboards.cljs | 38 +++++++++---------- 1 file changed, 18 insertions(+), 20 deletions(-) diff --git a/src/main/frontend/handler/editor/keyboards.cljs b/src/main/frontend/handler/editor/keyboards.cljs index 6c6223bf7e..436b28a241 100644 --- a/src/main/frontend/handler/editor/keyboards.cljs +++ b/src/main/frontend/handler/editor/keyboards.cljs @@ -1,6 +1,5 @@ (ns frontend.handler.editor.keyboards - (:require [dommy.core :as d] - [frontend.handler.editor :as editor-handler] + (:require [frontend.handler.editor :as editor-handler] [frontend.mixins :as mixins] [frontend.state :as state] [goog.dom :as gdom])) @@ -13,26 +12,25 @@ state :on-hide (fn [_state e event] - (let [target (.-target e)] - (cond - (contains? - #{:commands :block-commands - :page-search :page-search-hashtag :block-search :template-search - :property-search :property-value-search - :datepicker} - (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 + (cond + (contains? + #{:commands :block-commands + :page-search :page-search-hashtag :block-search :template-search + :property-search :property-value-search + :datepicker} + (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 - ;; editor/input component handles Escape directly, so just prevent handling it here - (= :input (state/get-editor-action)) - nil + ;; editor/input component handles Escape directly, so just prevent handling it here + (= :input (state/get-editor-action)) + nil - :else - (let [{:keys [on-hide value]} (editor-handler/get-state)] - (when on-hide - (on-hide value event)) - (when (contains? #{:esc :visibilitychange :click} event) - (state/clear-edit!)))))) + :else + (let [{:keys [on-hide value]} (editor-handler/get-state)] + (when on-hide + (on-hide value event)) + (when (contains? #{:esc :visibilitychange :click} event) + (state/clear-edit!))))) :node (gdom/getElement id) ;; :visibilitychange? true )))