mirror of
https://github.com/penpot/penpot.git
synced 2025-07-31 01:28:32 +02:00
🐛 Disale button on empty comments
This commit is contained in:
parent
09131f7533
commit
d854398dae
1 changed files with 10 additions and 6 deletions
|
@ -122,6 +122,13 @@
|
||||||
(d/seek (fn [[it _]] (= node it)))
|
(d/seek (fn [[it _]] (= node it)))
|
||||||
(second)))
|
(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
|
;; Component that renders the component content
|
||||||
(mf/defc comment-content*
|
(mf/defc comment-content*
|
||||||
{::mf/private true}
|
{::mf/private true}
|
||||||
|
@ -602,8 +609,7 @@
|
||||||
(let [show-buttons? (mf/use-state false)
|
(let [show-buttons? (mf/use-state false)
|
||||||
content (mf/use-state "")
|
content (mf/use-state "")
|
||||||
|
|
||||||
disabled? (or (str/blank? @content)
|
disabled? (blank-content? @content)
|
||||||
(str/empty? @content))
|
|
||||||
|
|
||||||
on-focus
|
on-focus
|
||||||
(mf/use-fn
|
(mf/use-fn
|
||||||
|
@ -664,8 +670,7 @@
|
||||||
(mf/deps @content)
|
(mf/deps @content)
|
||||||
(fn [] (on-submit @content)))
|
(fn [] (on-submit @content)))
|
||||||
|
|
||||||
disabled? (or (str/blank? @content)
|
disabled? (blank-content? @content)]
|
||||||
(str/empty? @content))]
|
|
||||||
|
|
||||||
[:div {:class (stl/css :form)}
|
[:div {:class (stl/css :form)}
|
||||||
[:> comment-input*
|
[:> comment-input*
|
||||||
|
@ -698,8 +703,7 @@
|
||||||
pos-x (* (:x position) zoom)
|
pos-x (* (:x position) zoom)
|
||||||
pos-y (* (:y position) zoom)
|
pos-y (* (:y position) zoom)
|
||||||
|
|
||||||
disabled? (or (str/blank? content)
|
disabled? (blank-content? content)
|
||||||
(str/empty? content))
|
|
||||||
|
|
||||||
on-esc
|
on-esc
|
||||||
(mf/use-fn
|
(mf/use-fn
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue