Jelajahi Sumber

fix: can't delete selected blocks in queries

Tienson Qin 3 tahun lalu
induk
melakukan
442b65d210
1 mengubah file dengan 4 tambahan dan 1 penghapusan
  1. 4 1
      src/main/frontend/handler/editor.cljs

+ 4 - 1
src/main/frontend/handler/editor.cljs

@@ -1073,7 +1073,10 @@
     ;; remove embeds, references and queries
     (let [dom-blocks (remove (fn [block]
                               (or (= "true" (dom/attr block "data-transclude"))
-                                  (= "true" (dom/attr block "data-query")))) blocks)]
+                                  (= "true" (dom/attr block "data-query")))) blocks)
+          dom-blocks (if (seq dom-blocks) dom-blocks
+                         (remove (fn [block]
+                                   (or (= "true" (dom/attr block "data-transclude")))) blocks))]
       (when (seq dom-blocks)
         (let [repo (state/get-current-repo)
               block-uuids (distinct (map #(uuid (dom/attr % "blockid")) dom-blocks))