File tree Expand file tree Collapse file tree 3 files changed +18
-7
lines changed
deps/outliner/src/logseq/outliner
src/main/frontend/handler Expand file tree Collapse file tree 3 files changed +18
-7
lines changed Original file line number Diff line number Diff line change 795795 :or {update-timestamps? true }}]
796796 {:pre [(seq blocks)
797797 (m/validate block-map-or-entity target-block)]}
798- (let [blocks (->>
798+ (let [blocks (cond ->>
799799 (keep (fn [b]
800800 (if-let [eid (or (:db/id b)
801801 (when-let [id (:block/uuid b)]
813813 (apply dissoc b' dissoc-keys))
814814 b))
815815 blocks)
816- (remove ldb/asset?))
816+ (or (= outliner-op :paste )
817+ insert-template?)
818+ (remove ldb/asset?))
817819 [target-block sibling?] (get-target-block db blocks target-block opts)
818820 _ (assert (some? target-block) (str " Invalid target: " target-block))
819821 replace-empty-target? (if (and (some? replace-empty-target?)
11611163 (insert-blocks repo @conn blocks target-block opts))]
11621164 (defn insert-blocks!
11631165 [repo conn blocks target-block opts]
1164- (op-transact! :insert-blocks f repo conn blocks target-block (assoc opts :outliner-op :insert-blocks ))))
1166+ (op-transact! :insert-blocks f repo conn blocks target-block
1167+ (if (:outliner-op opts)
1168+ opts
1169+ (assoc opts :outliner-op :insert-blocks )))))
11651170
11661171(let [f (fn [_repo conn blocks _opts]
11671172 (delete-blocks @conn blocks))]
11721177(defn move-blocks!
11731178 [repo conn blocks target-block opts]
11741179 (op-transact! :move-blocks move-blocks repo conn blocks target-block
1175- (assoc opts :outliner-op :move-blocks )))
1180+ (if (:outliner-op opts)
1181+ opts
1182+ (assoc opts :outliner-op :move-blocks ))))
11761183
11771184(defn move-blocks-up-down!
11781185 [repo conn blocks up?]
Original file line number Diff line number Diff line change 326326(declare save-current-block! )
327327(defn outliner-insert-block!
328328 [config current-block new-block {:keys [sibling? keep-uuid? ordered-list?
329- replace-empty-target?]}]
329+ replace-empty-target? outliner-op ]}]
330330 (let [ref-query-top-block? (and (or (:ref? config)
331331 (:custom-query? config))
332332 (not (:ref-query-child? config)))
359359 (outliner-op/insert-blocks! [new-block'] current-block {:sibling? sibling?
360360 :keep-uuid? keep-uuid?
361361 :ordered-list? ordered-list?
362- :replace-empty-target? replace-empty-target?}))))
362+ :replace-empty-target? replace-empty-target?
363+ :outliner-op outliner-op}))))
363364
364365(defn- block-self-alone-when-insert?
365366 [config uuid]
559560 [content {:keys [page block-uuid
560561 sibling? before? start? end?
561562 properties
562- custom-uuid replace-empty-target? edit-block? ordered-list? other-attrs]
563+ custom-uuid replace-empty-target? edit-block? ordered-list? other-attrs
564+ outliner-op]
563565 :or {sibling? false
564566 before? false
565567 edit-block? true }
640642 {:sibling? sibling?
641643 :keep-uuid? true
642644 :ordered-list? ordered-list?
645+ :outliner-op outliner-op
643646 :replace-empty-target? replace-empty-target?})))
644647 (when edit-block?
645648 (if (and replace-empty-target?
Original file line number Diff line number Diff line change 213213 (editor-handler/api-insert-new-block! " "
214214 {:block-uuid (:block/uuid current-block)
215215 :sibling? true
216+ :outliner-op :paste
216217 :replace-empty-target? true
217218 :other-attrs {:block/link (:db/id (db/entity [:block/uuid block-id]))}})
218219 (state/clear-edit! )))))
You can’t perform that action at this time.
0 commit comments