mirror of https://github.com/logseq/logseq
chore: remove unused code
parent
cab8804c24
commit
6f80796c57
|
@ -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)}
|
||||
|
|
|
@ -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)]
|
||||
|
|
Loading…
Reference in New Issue