mirror of
https://github.com/logseq/logseq.git
synced 2026-05-04 02:46:45 +00:00
fix: Deleting embedded blocks deletes source material
close #1836 #1652
This commit is contained in:
@@ -986,12 +986,15 @@
|
||||
[copy?]
|
||||
(when copy? (copy-selection-blocks))
|
||||
(when-let [blocks (seq (get-selected-blocks-with-children))]
|
||||
(let [repo (dom/attr (first blocks) "repo")
|
||||
ids (distinct (map #(uuid (dom/attr % "blockid")) blocks))
|
||||
ids (if (= :up (state/get-selection-direction))
|
||||
(reverse ids)
|
||||
ids)]
|
||||
(delete-blocks! repo ids))))
|
||||
;; remove embeds and references
|
||||
(let [blocks (remove (fn [block] (= "true" (dom/attr block "data-transclude"))) blocks)]
|
||||
(when (seq blocks)
|
||||
(let [repo (dom/attr (first blocks) "repo")
|
||||
ids (distinct (map #(uuid (dom/attr % "blockid")) blocks))
|
||||
ids (if (= :up (state/get-selection-direction))
|
||||
(reverse ids)
|
||||
ids)]
|
||||
(delete-blocks! repo ids))))))
|
||||
|
||||
(defn- get-nearest-page
|
||||
[]
|
||||
|
||||
Reference in New Issue
Block a user