From 327c29af493da9e77833222cfe750fa8f5f67e8b Mon Sep 17 00:00:00 2001 From: Tienson Qin Date: Mon, 3 Apr 2023 17:45:53 +0800 Subject: [PATCH] fix: disable backspace from the start and delete in the end for query --- src/main/frontend/handler/editor.cljs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/main/frontend/handler/editor.cljs b/src/main/frontend/handler/editor.cljs index 6073080639..41f52a1061 100644 --- a/src/main/frontend/handler/editor.cljs +++ b/src/main/frontend/handler/editor.cljs @@ -2693,7 +2693,10 @@ (delete-and-update input selected-start selected-end) (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 (delete-and-update input current-pos (inc current-pos)))))) @@ -2723,11 +2726,13 @@ (delete-and-update input selected-start selected-end)) (zero? current-pos) - (do + (let [editor-state (get-state) + custom-query? (get-in editor-state [:config :custom-query?])] (util/stop e) (when (and (if top-block? (string/blank? value) true) (not root-block?) - (not single-block?)) + (not single-block?) + (not custom-query?)) (delete-block! repo false))) (and (> current-pos 1)