mirror of
https://github.com/penpot/penpot.git
synced 2025-08-07 14:38:33 +02:00
🐛 Avoid empty names in projects, files and pages
This commit is contained in:
parent
918829ad0a
commit
9dfd5c0bcc
5 changed files with 19 additions and 10 deletions
|
@ -16,6 +16,7 @@
|
|||
[app.main.ui.icons :as i]
|
||||
[app.util.dom :as dom]
|
||||
[app.util.i18n :as i18n :refer [tr]]
|
||||
[cuerdas.core :as str]
|
||||
[rumext.alpha :as mf]))
|
||||
|
||||
(mf/defc header
|
||||
|
@ -63,9 +64,11 @@
|
|||
(if (:edition @local)
|
||||
[:& inline-edition {:content (:name project)
|
||||
:on-end (fn [name]
|
||||
(st/emit! (-> (dd/rename-project (assoc project :name name))
|
||||
(with-meta {::ev/origin "project"})))
|
||||
(swap! local assoc :edition false))}]
|
||||
(let [name (str/trim name)]
|
||||
(when-not (str/empty? name)
|
||||
(st/emit! (-> (dd/rename-project (assoc project :name name))
|
||||
(with-meta {::ev/origin "project"}))))
|
||||
(swap! local assoc :edition false)))}]
|
||||
[:div.dashboard-title
|
||||
[:h1 {:on-double-click on-edit}
|
||||
(:name project)]]))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue