mirror of
https://github.com/logseq/logseq.git
synced 2026-05-03 02:16:30 +00:00
fix: add an explicit border for the border children to solve the overlay click problem
This commit is contained in:
@@ -1346,13 +1346,12 @@
|
||||
(util/stop e))
|
||||
(route-handler/redirect-to-page! uuid)))
|
||||
|
||||
(defn- block-left-border-on-click
|
||||
(defn- toggle-block-children
|
||||
[e children]
|
||||
(if (< (.-offsetX (.-nativeEvent e)) 10)
|
||||
(let [block-ids (map :block/uuid children)]
|
||||
(if (some editor-handler/collapsable? block-ids)
|
||||
(dorun (map editor-handler/collapse-block! block-ids))
|
||||
(dorun (map editor-handler/expand-block! block-ids))))))
|
||||
(let [block-ids (map :block/uuid children)]
|
||||
(if (some editor-handler/collapsable? block-ids)
|
||||
(dorun (map editor-handler/collapse-block! block-ids))
|
||||
(dorun (map editor-handler/expand-block! block-ids)))))
|
||||
|
||||
(rum/defc block-children < rum/reactive
|
||||
[config children collapsed? *ref-collapsed?]
|
||||
@@ -1363,24 +1362,25 @@
|
||||
(seq children)
|
||||
(not collapsed?))
|
||||
(let [doc-mode? (state/sub :document/mode?)]
|
||||
[:div.block-children {:style {:margin-left (if doc-mode? 18
|
||||
(if (or (mobile-util/native-android?)
|
||||
(mobile-util/native-iphone?))
|
||||
22
|
||||
29))
|
||||
:display (if collapsed? "none" "")}
|
||||
:on-click (fn [event] (block-left-border-on-click event children))}
|
||||
(for [child children]
|
||||
(when (map? child)
|
||||
(let [child (dissoc child :block/meta)
|
||||
config (cond->
|
||||
(-> config
|
||||
(assoc :block/uuid (:block/uuid child))
|
||||
(dissoc :breadcrumb-show? :embed-parent))
|
||||
ref?
|
||||
(assoc :ref-child? true))]
|
||||
(rum/with-key (block-container config child)
|
||||
(:block/uuid child)))))]))))
|
||||
[:div.block-children-container {:style {:display "flex"
|
||||
:margin-left (if doc-mode? 18
|
||||
(if (or (mobile-util/native-android?)
|
||||
(mobile-util/native-iphone?))
|
||||
22
|
||||
29))}}
|
||||
[:div.block-children-left-border {:on-click (fn [event] (toggle-block-children event children))}]
|
||||
[:div.block-children {:style {:display (if collapsed? "none" "")}}
|
||||
(for [child children]
|
||||
(when (map? child)
|
||||
(let [child (dissoc child :block/meta)
|
||||
config (cond->
|
||||
(-> config
|
||||
(assoc :block/uuid (:block/uuid child))
|
||||
(dissoc :breadcrumb-show? :embed-parent))
|
||||
ref?
|
||||
(assoc :ref-child? true))]
|
||||
(rum/with-key (block-container config child)
|
||||
(:block/uuid child)))))]]))))
|
||||
|
||||
(defn- block-content-empty?
|
||||
[{:block/keys [properties title body]}]
|
||||
|
||||
Reference in New Issue
Block a user