ソースを参照

fix: disable cut selections in the query result block

Tienson Qin 4 年 前
コミット
10e7a9fbd6

+ 5 - 1
src/main/frontend/components/block.cljs

@@ -2064,6 +2064,7 @@
         breadcrumb-show? (:breadcrumb-show? config)
         sidebar? (boolean (:sidebar? config))
         slide? (boolean (:slide? config))
+        custom-query? (boolean (:custom-query? config))
         doc-mode? (:document/mode? config)
         embed? (:embed? config)
         reference? (:reference? config)
@@ -2098,7 +2099,10 @@
        (merge attrs)
 
        (or reference? embed?)
-       (assoc :data-transclude true))
+       (assoc :data-transclude true)
+
+       custom-query?
+       (assoc :data-query true))
 
      (when (and ref? breadcrumb-show?)
        (when-let [comp (block-parents config repo uuid format false)]

+ 5 - 2
src/main/frontend/handler/editor.cljs

@@ -1137,8 +1137,10 @@
   [copy?]
   (when copy? (copy-selection-blocks))
   (when-let [blocks (seq (get-selected-blocks-with-children))]
-    ;; remove embeds and references
-    (let [blocks (remove (fn [block] (= "true" (dom/attr block "data-transclude"))) blocks)]
+    ;; remove embeds, references and queries
+    (let [blocks (remove (fn [block]
+                           (or (= "true" (dom/attr block "data-transclude"))
+                               (= "true" (dom/attr block "data-query")))) blocks)]
       (when (seq blocks)
         (let [repo (state/get-current-repo)
               ids (distinct (map #(uuid (dom/attr % "blockid")) blocks))]
@@ -2830,6 +2832,7 @@
   [copy?]
   (cut-selection-blocks copy?)
   (clear-selection!))
+
 (defn shortcut-copy-selection
   [e]
   (copy-selection-blocks))