Revert "Remove unused state"

This reverts commit 8419afe007.
pull/10793/head
Tienson Qin 2024-01-16 13:27:48 +08:00
parent 77bcd70a2a
commit 45348a694b
3 changed files with 86 additions and 73 deletions

View File

@ -2966,6 +2966,11 @@
selected? (when-not (:slide? config)
(state/sub-block-selected? uuid))
children (:block/_parent block)]
(cond
(= (:ui/deleting-block @state/state) (:block/uuid block))
nil
:else
[:div.ls-block
(cond->
{:blockid (str uuid)
@ -3054,7 +3059,7 @@
(dissoc :original-block))]
(block-children config' block children' collapsed?)))
(when-not in-whiteboard? (dnd-separator-wrapper block children block-id slide? false false))]))
(when-not in-whiteboard? (dnd-separator-wrapper block children block-id slide? false false))])))
(defn- block-changed?
[old-block new-block]

View File

@ -692,6 +692,7 @@
block (db/pull repo '[*] [:block/uuid uuid])]
(when block
(let [blocks (block-handler/get-top-level-blocks [block])]
(state/set-state! :ui/deleting-block uuid)
(ui-outliner-tx/transact!
{:outliner-op :delete-blocks}
(outliner-core/delete-blocks! repo (db/get-db false)

View File

@ -88,6 +88,13 @@
(when (= (:outliner-op tx-meta) :rename-page)
(state/pub-event! [:page/renamed repo (:data tx-meta)]))
(when-let [deleting-block-id (:ui/deleting-block @state/state)]
(when (some (fn [datom] (and
(= :block/uuid (:a datom))
(= (:v datom) deleting-block-id)
(true? (:added datom)))) tx-data) ; editing-block was added back (could be undo or from remote sync)
(state/set-state! :ui/deleting-block nil)))
(when request-id
(when-let [deferred (ldb/get-deferred-response request-id)]
(p/resolve! deferred {:tx-meta tx-meta