mirror of
https://github.com/logseq/logseq.git
synced 2026-06-01 19:01:22 +00:00
cut blocks remains uuid
This commit is contained in:
@@ -801,6 +801,10 @@
|
||||
|
||||
(declare save-block!)
|
||||
|
||||
(defn- block-has-no-ref?
|
||||
[eid]
|
||||
(empty? (:block/_refs (db/entity eid))))
|
||||
|
||||
(defn delete-block!
|
||||
([repo]
|
||||
(delete-block! repo true))
|
||||
@@ -988,6 +992,7 @@
|
||||
(let [html (export-html/export-blocks-as-html repo top-level-block-uuids nil)
|
||||
copied-blocks (get-all-blocks-by-ids repo top-level-block-uuids)]
|
||||
(common-handler/copy-to-clipboard-without-id-property! (:block/format block) content (when html? html) copied-blocks))
|
||||
(state/set-block-op-type! :copy)
|
||||
(notification/show! "Copied!" :success)))))
|
||||
|
||||
(defn copy-block-refs
|
||||
@@ -1056,6 +1061,7 @@
|
||||
(defn cut-selection-blocks
|
||||
[copy?]
|
||||
(when copy? (copy-selection-blocks true))
|
||||
(state/set-block-op-type! :cut)
|
||||
(when-let [blocks (seq (get-selected-blocks))]
|
||||
;; remove embeds, references and queries
|
||||
(let [dom-blocks (remove (fn [block]
|
||||
@@ -1204,6 +1210,7 @@
|
||||
html (export-html/export-blocks-as-html repo [block-id] nil)
|
||||
sorted-blocks (tree/get-sorted-block-and-children repo (:db/id block))]
|
||||
(common-handler/copy-to-clipboard-without-id-property! (:block/format block) md-content html sorted-blocks)
|
||||
(state/set-block-op-type! :cut)
|
||||
(delete-block-aux! block true))))
|
||||
|
||||
(defn highlight-selection-area!
|
||||
@@ -2018,16 +2025,16 @@
|
||||
empty-target? (string/blank? (:block/content target-block))
|
||||
paste-nested-blocks? (nested-blocks blocks)
|
||||
target-block-has-children? (db/has-children? (:block/uuid target-block))
|
||||
replace-empty-target? (if (and paste-nested-blocks? empty-target? target-block-has-children?)
|
||||
false
|
||||
true)
|
||||
target-block' (if replace-empty-target? target-block
|
||||
(db/pull (:db/id (:block/left target-block))))
|
||||
replace-empty-target? (and empty-target?
|
||||
(or (not target-block-has-children?)
|
||||
(and target-block-has-children? (= (count blocks) 1)))
|
||||
(block-has-no-ref? (:db/id target-block)))
|
||||
target-block' (if (and empty-target? target-block-has-children? paste-nested-blocks?)
|
||||
(db/pull (:db/id (:block/left target-block)))
|
||||
target-block)
|
||||
sibling? (cond
|
||||
(and paste-nested-blocks? empty-target?)
|
||||
(if (= (:block/parent target-block') (:block/parent target-block))
|
||||
true
|
||||
false)
|
||||
(= (:block/parent target-block') (:block/parent target-block))
|
||||
|
||||
(some? sibling?)
|
||||
sibling?
|
||||
@@ -2056,6 +2063,7 @@
|
||||
:outliner-op :paste
|
||||
:replace-empty-target? replace-empty-target?
|
||||
:keep-uuid? keep-uuid?})]
|
||||
(state/set-block-op-type! nil)
|
||||
(edit-last-block-after-inserted! result))))))
|
||||
|
||||
(defn- block-tree->blocks
|
||||
|
||||
Reference in New Issue
Block a user