mirror of
https://github.com/logseq/logseq.git
synced 2026-05-30 07:29:48 +00:00
fix: Deleting embedded blocks deletes source material
close #1836 #1652
This commit is contained in:
@@ -658,7 +658,7 @@
|
||||
|
||||
["Block_reference" id]
|
||||
;; FIXME: alert when self block reference
|
||||
(block-reference config id nil)
|
||||
(block-reference (assoc config :reference? true) id nil)
|
||||
|
||||
["Nested_link" link]
|
||||
(nested-link config html-export? link)
|
||||
@@ -1679,6 +1679,7 @@
|
||||
slide? (boolean (:slide? config))
|
||||
doc-mode? (:document/mode? config)
|
||||
embed? (:embed? config)
|
||||
reference? (:reference? config)
|
||||
unique-dom-id (build-id (dissoc config :block/uuid))
|
||||
block-id (str "ls-block-" unique-dom-id uuid)
|
||||
has-child? (boolean
|
||||
@@ -1701,8 +1702,12 @@
|
||||
:blockid (str uuid)
|
||||
:repo repo
|
||||
:haschild (str has-child?)}
|
||||
|
||||
(not slide?)
|
||||
(merge attrs))
|
||||
(merge attrs)
|
||||
|
||||
(or reference? embed?)
|
||||
(assoc :data-transclude true))
|
||||
|
||||
(when (and ref? breadcrumb-show?)
|
||||
(when-let [comp (block-parents config repo uuid format false)]
|
||||
|
||||
@@ -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