enhance: show selection action bar on mouse up

This commit is contained in:
Tienson Qin
2025-02-28 17:01:09 +08:00
parent fec44379f8
commit 3ba14c6051
7 changed files with 118 additions and 69 deletions

View File

@@ -904,11 +904,11 @@
(show! (cp-content/block-ref-custom-context-menu-content block block-ref))
(state/set-state! :block-ref/context nil))
;; block selection
;; block selection
(and (state/selection?) (not (d/has-class? target "bullet")))
(show! (cp-content/custom-context-menu-content))
;; block bullet
;; block bullet
(and block-id (parse-uuid block-id))
(let [block (.closest target ".ls-block")
property-default-value? (when block
@@ -925,6 +925,15 @@
[]
nil)
(defonce *action-bar-timeout (atom nil))
(defn- on-mouse-up
[_e]
(when-let [timeout @*action-bar-timeout]
(js/clearTimeout timeout))
(let [timeout (js/setTimeout #(state/pub-event! [:editor/show-action-bar]) 200)]
(reset! *action-bar-timeout timeout)))
(rum/defcs ^:large-vars/cleanup-todo root-container < rum/reactive
(mixins/event-mixin
(fn [state]
@@ -1017,6 +1026,7 @@
(ui/focus-element (ui/main-node))))}
(t :accessibility/skip-to-main-content)]
[:div.#app-container
{:on-mouse-up on-mouse-up}
[:div#left-container
{:class (if (state/sub :ui/sidebar-open?) "overflow-hidden" "w-full")}
(header/header {:light? light?