fix: don't clear selection in blocks

This commit is contained in:
Tienson Qin
2022-11-14 14:32:21 +08:00
parent a939767aaf
commit db7bc72a3c
3 changed files with 17 additions and 11 deletions

View File

@@ -914,14 +914,15 @@ Similar to re-frame subscriptions"
(when-let [input (get-input)]
(util/get-selection-start input)))
(defn set-selection-start-block!
[start-block]
(swap! state assoc :selection/start-block start-block))
(defn get-selection-start-block
[]
(get @state :selection/start-block))
(defn set-selection-start-block!
[start-block]
(when-not (get-selection-start-block)
(swap! state assoc :selection/start-block start-block)))
(defn set-selection-blocks!
([blocks]
(set-selection-blocks! blocks :down))
@@ -942,7 +943,8 @@ Similar to re-frame subscriptions"
(swap! state assoc
:selection/mode false
:selection/blocks nil
:selection/direction :down))
:selection/direction :down
:selection/start-block nil))
(defn get-selection-blocks
[]
@@ -1963,4 +1965,4 @@ Similar to re-frame subscriptions"
(defn get-icloud-container-root-url
[]
(when (mobile-util/native-ios?)
(get-in @state [:mobile/container-urls :iCloudContainerUrl])))
(get-in @state [:mobile/container-urls :iCloudContainerUrl])))