improve(ux): WIP support place fold arrow on the right of block container

This commit is contained in:
charlie
2022-11-24 15:54:38 +08:00
parent 66e7a80fd0
commit b3a6ed21de
6 changed files with 62 additions and 21 deletions

View File

@@ -1707,7 +1707,7 @@
(every? #(= % ["Horizontal_Rule"]) body)))
(rum/defcs block-control < rum/reactive
[state config block uuid block-id collapsed? *control-show? edit?]
[state config block uuid block-id collapsed? *control-show? edit? has-child?]
(let [doc-mode? (state/sub :document/mode?)
control-show? (util/react *control-show?)
ref? (:ref? config)
@@ -1717,20 +1717,22 @@
:margin-top 0
:float "left"}}
[:a.block-control
{:id (str "control-" uuid)
:on-click (fn [event]
(util/stop event)
(state/clear-edit!)
(if ref?
(state/toggle-collapsed-block! uuid)
(if collapsed?
(editor-handler/expand-block! uuid)
(editor-handler/collapse-block! uuid))))}
[:span {:class (if (and control-show?
(or collapsed?
(editor-handler/collapsable? uuid {:semantic? true}))) "control-show cursor-pointer" "control-hide")}
(ui/rotating-arrow collapsed?)]]
(when has-child?
[:a.block-control
{:id (str "control-" uuid)
:on-click (fn [event]
(util/stop event)
(state/clear-edit!)
(if ref?
(state/toggle-collapsed-block! uuid)
(if collapsed?
(editor-handler/expand-block! uuid)
(editor-handler/collapse-block! uuid))))}
[:span {:class (if (and control-show?
(or collapsed?
(editor-handler/collapsable? uuid {:semantic? true}))) "control-show cursor-pointer" "control-hide")}
(ui/rotating-arrow collapsed?)]])
(let [bullet [:a {:on-click (fn [event]
(bullet-on-click event block uuid))}
[:span.bullet-container.cursor
@@ -2761,7 +2763,7 @@
:on-mouse-leave (fn [e]
(block-mouse-leave e *control-show? block-id doc-mode?))}
(when (not slide?)
(block-control config block uuid block-id collapsed? *control-show? edit?))
(block-control config block uuid block-id collapsed? *control-show? edit? has-child?))
(when @*show-left-menu?
(block-left-menu config block))