diff --git a/src/main/frontend/handler/editor.cljs b/src/main/frontend/handler/editor.cljs index 5e50e23e4..6caa32fa5 100644 --- a/src/main/frontend/handler/editor.cljs +++ b/src/main/frontend/handler/editor.cljs @@ -587,9 +587,7 @@ {:ok-handler (fn [last-block] (clear-when-saved!) - (edit-block! last-block 0 id) - (when-let [order-list-type (and (own-order-list? block) (get-block-own-order-list-type block))] - (set-block-own-order-list-type! last-block order-list-type)))})))) + (edit-block! last-block 0 id))})))) (state/set-editor-op! nil))) (defn api-insert-new-block! diff --git a/src/main/frontend/modules/outliner/core.cljs b/src/main/frontend/modules/outliner/core.cljs index 0084dbc0f..57c57cd98 100644 --- a/src/main/frontend/modules/outliner/core.cljs +++ b/src/main/frontend/modules/outliner/core.cljs @@ -409,6 +409,18 @@ last rest)))) +(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))) + ;;; ### insert-blocks, delete-blocks, move-blocks (defn fix-top-level-blocks @@ -519,6 +531,7 @@ (> (count blocks) 1) (not move?))) blocks' (blocks-with-level blocks) + blocks' (blocks-with-?ordered-list-props blocks' target-block sibling?) blocks' (if (= outliner-op :paste) (fix-top-level-blocks blocks') blocks') @@ -527,7 +540,8 @@ :keep-uuid? keep-uuid? :move? move? :outliner-op outliner-op} - tx (insert-blocks-aux blocks' target-block' insert-opts)] + tx (insert-blocks-aux blocks' target-block' insert-opts) + _ (prn "====>>> op:insert-blocks tx#" tx)] (if (some (fn [b] (or (nil? (:block/parent b)) (nil? (:block/left b)))) tx) (do (state/pub-event! [:capture-error {:error "Outliner invalid structure" @@ -559,8 +573,10 @@ full-tx (util/concat-without-nil uuids-tx tx next-tx)] (when (and replace-empty-target? (state/editing?)) (state/set-edit-content! (state/get-edit-input-id) (:block/content (first blocks)))) - {:tx-data full-tx - :blocks tx})))) + (let [output {:tx-data full-tx + :blocks tx}] + (prn "==>>> op:insert-blocks full-tx#" output) + output))))) (defn- build-move-blocks-next-tx [blocks non-consecutive-blocks?]