Browse Source

fix: disable backspace from the start and delete in the end for query

Tienson Qin 2 years ago
parent
commit
327c29af49
1 changed files with 8 additions and 3 deletions
  1. 8 3
      src/main/frontend/handler/editor.cljs

+ 8 - 3
src/main/frontend/handler/editor.cljs

@@ -2693,7 +2693,10 @@
         (delete-and-update input selected-start selected-end)
         (delete-and-update input selected-start selected-end)
 
 
         (and end? current-block)
         (and end? current-block)
-        (delete-concat current-block)
+        (let [editor-state (get-state)
+              custom-query? (get-in editor-state [:config :custom-query?])]
+          (when-not custom-query?
+            (delete-concat current-block)))
 
 
         :else
         :else
         (delete-and-update input current-pos (inc current-pos))))))
         (delete-and-update input current-pos (inc current-pos))))))
@@ -2723,11 +2726,13 @@
         (delete-and-update input selected-start selected-end))
         (delete-and-update input selected-start selected-end))
 
 
       (zero? current-pos)
       (zero? current-pos)
-      (do
+      (let [editor-state (get-state)
+            custom-query? (get-in editor-state [:config :custom-query?])]
         (util/stop e)
         (util/stop e)
         (when (and (if top-block? (string/blank? value) true)
         (when (and (if top-block? (string/blank? value) true)
                    (not root-block?)
                    (not root-block?)
-                   (not single-block?))
+                   (not single-block?)
+                   (not custom-query?))
           (delete-block! repo false)))
           (delete-block! repo false)))
 
 
       (and (> current-pos 1)
       (and (> current-pos 1)