0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-02-14 19:19:09 -05:00

Merge pull request #5699 from penpot/ddb-empty-comment-disable

🐛 Disable button on empty comments
This commit is contained in:
luisδμ 2025-01-28 16:31:14 +01:00 committed by GitHub
commit 1ebd5be3b1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -122,6 +122,13 @@
(d/seek (fn [[it _]] (= node it)))
(second)))
(defn- blank-content?
[content]
(or (str/blank? content)
(str/empty? content)
;; If only one char and it's the zero-width whitespace
(and (= 1 (count content)) (= (first content) \u200B))))
;; Component that renders the component content
(mf/defc comment-content*
{::mf/private true}
@ -602,8 +609,7 @@
(let [show-buttons? (mf/use-state false)
content (mf/use-state "")
disabled? (or (str/blank? @content)
(str/empty? @content))
disabled? (blank-content? @content)
on-focus
(mf/use-fn
@ -664,8 +670,7 @@
(mf/deps @content)
(fn [] (on-submit @content)))
disabled? (or (str/blank? @content)
(str/empty? @content))]
disabled? (blank-content? @content)]
[:div {:class (stl/css :form)}
[:> comment-input*
@ -698,8 +703,7 @@
pos-x (* (:x position) zoom)
pos-y (* (:y position) zoom)
disabled? (or (str/blank? content)
(str/empty? content))
disabled? (blank-content? content)
on-esc
(mf/use-fn