mirror of
https://github.com/penpot/penpot.git
synced 2025-04-16 08:51:32 -05:00
🐛 Do not allow to create an empty annotation
This commit is contained in:
parent
0c1f6f8e71
commit
3a1f861303
1 changed files with 2 additions and 2 deletions
|
@ -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)))
|
||||
|
|
Loading…
Add table
Reference in a new issue