From 6f80796c57fdc290808c6b9314c99ae9f0ea63e5 Mon Sep 17 00:00:00 2001 From: Tienson Qin Date: Tue, 6 Apr 2021 17:21:54 +0800 Subject: [PATCH] chore: remove unused code --- src/main/frontend/components/editor.cljs | 4 +-- src/main/frontend/handler/editor.cljs | 42 ------------------------ 2 files changed, 2 insertions(+), 44 deletions(-) diff --git a/src/main/frontend/components/editor.cljs b/src/main/frontend/components/editor.cljs index f57212feb..e372d55bb 100644 --- a/src/main/frontend/components/editor.cljs +++ b/src/main/frontend/components/editor.cljs @@ -150,10 +150,10 @@ [parent-state parent-id] [:div#mobile-editor-toolbar.bg-base-2.fix-ios-fixed-bottom [:button.bottom-action - {:on-click #(editor-handler/adjust-block-level! parent-state :right)} + {:on-click #(editor-handler/indent-on-tab parent-state)} svg/indent-block] [:button.bottom-action - {:on-click #(editor-handler/adjust-block-level! parent-state :left)} + {:on-click #(editor-handler/outdent-on-shift-tab parent-state)} svg/outdent-block] [:button.bottom-action {:on-click #(editor-handler/move-up-down % true)} diff --git a/src/main/frontend/handler/editor.cljs b/src/main/frontend/handler/editor.cljs index e0f2d2815..8f87afe1a 100644 --- a/src/main/frontend/handler/editor.cljs +++ b/src/main/frontend/handler/editor.cljs @@ -1495,48 +1495,6 @@ (when-let [prev-block (util/get-prev-block input)] (util/parse-int (d/attr prev-block "level"))))) -;; If it's an indent/outdent action followed by an "Enter", only adjust after inserting a block was finished. Maybe we should use a channel to serialize all the events. -(defn adjust-block-level! - ([state direction] - (adjust-block-level! state direction 100)) - ([state direction retry-limit] - (if (= :insert (state/get-editor-op)) - (if (> retry-limit 0) - (js/setTimeout #(adjust-block-level! state direction (dec retry-limit)) 20) - (log/error :editor/indent-outdent-retry-max-limit {:direction direction})) - (do - (state/set-editor-op! :indent-outdent) - (let [{:keys [block block-parent-id value config]} (get-state state) - start-level (:start-level config) - format (:block/format block) - level (:block/level block) - previous-level (or (get-previous-block-level block-parent-id) 1) - [add? remove?] (case direction - :left [false true] - :right [true false] - [(<= level previous-level) - (and (> level previous-level) - (> level 2))]) - final-level (cond - add? (inc level) - remove? (if (> level 2) - (dec level) - level) - :else level) - new-value (block/with-levels value format (assoc block :block/level final-level))] - (when (and - (not (and (= direction :left) - (get config :id) - (util/uuid-string? (get config :id)) - (<= final-level start-level))) - (<= (- final-level previous-level) 1)) - (save-block-if-changed! block new-value - {:indent-left? (= direction :left)}))) - (state/set-editor-op! nil))))) - -(defn adjust-blocks-level! - [blocks direction]) - (defn append-paste-doc! [format event] (let [[html text] (util/get-clipboard-as-html event)]