fix(ux): turn the block into ordered item when it's moved to the first item from target ordered children

pull/9269/head
charlie 2023-04-26 13:03:14 +08:00
parent 90f4bff1d5
commit f55ccda97e
2 changed files with 10 additions and 13 deletions

View File

@ -79,10 +79,6 @@
(when-let [uuid (:block/uuid block)]
(remove-block-property! uuid :logseq.order-list-type)))
(defn own-order-list?
[block]
(not (string/blank? (get-block-own-order-list-type block))))
(defn own-order-number-list?
[block]
(= (get-block-own-order-list-type block) "number"))

View File

@ -411,15 +411,16 @@
(defn blocks-with-?ordered-list-props
[blocks target-block sibling?]
(letfn [(list-type-fn [b] (some-> b :block/properties :logseq.order-list-type))]
(if-let [list-type (and sibling? target-block (list-type-fn target-block))]
(mapv
(fn [block]
(cond-> block
(some? (:block/properties block))
(assoc-in [:block/properties :logseq.order-list-type] list-type)))
blocks)
blocks)))
(let [target-block (if sibling? target-block (some-> target-block :db/id db/pull block tree/-get-down :data))]
(letfn [(list-type-fn [b] (some-> b :block/properties :logseq.order-list-type))]
(if-let [list-type (and target-block (list-type-fn target-block))]
(mapv
(fn [block]
(cond-> block
(some? (:block/uuid block))
(update :block/properties #(assoc % :logseq.order-list-type list-type))))
blocks)
blocks))))
;;; ### insert-blocks, delete-blocks, move-blocks