From 3a1f861303a3d3285d2dd6d27478566053b375ed Mon Sep 17 00:00:00 2001 From: Pablo Alba Date: Mon, 30 Oct 2023 22:48:50 +0100 Subject: [PATCH] :bug: Do not allow to create an empty annotation --- .../main/ui/workspace/sidebar/options/menus/component.cljs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/src/app/main/ui/workspace/sidebar/options/menus/component.cljs b/frontend/src/app/main/ui/workspace/sidebar/options/menus/component.cljs index 64b22078ec..f4f0114fcb 100644 --- a/frontend/src/app/main/ui/workspace/sidebar/options/menus/component.cljs +++ b/frontend/src/app/main/ui/workspace/sidebar/options/menus/component.cljs @@ -36,7 +36,7 @@ component-id (:component-id shape) annotation (:annotation component) editing? (mf/use-state false) - invalid-text? (mf/use-state (or (nil? annotation)(str/empty? annotation))) + invalid-text? (mf/use-state (or (nil? annotation) (str/blank? annotation))) size (mf/use-state (count annotation)) textarea-ref (mf/use-ref) @@ -44,7 +44,7 @@ ;; based on https://css-tricks.com/the-cleanest-trick-for-autogrowing-textareas/ autogrow #(let [textarea (mf/ref-val textarea-ref) text (when textarea (.-value textarea))] - (reset! invalid-text? (str/empty? text)) + (reset! invalid-text? (str/blank? text)) (when textarea (reset! size (count text)) (aset (.-dataset (.-parentNode textarea)) "replicatedValue" text)))