mirror of
https://github.com/penpot/penpot.git
synced 2025-01-23 06:58:58 -05:00
🐛 Don't allow empty strings and whitespace-only strings on media name
This commit is contained in:
parent
b64a9f0cf4
commit
a868dcf8e6
2 changed files with 14 additions and 12 deletions
|
@ -31,6 +31,7 @@
|
||||||
- Fix create and account only with spaces [Taiga #5518](https://tree.taiga.io/project/penpot/issue/5518)
|
- Fix create and account only with spaces [Taiga #5518](https://tree.taiga.io/project/penpot/issue/5518)
|
||||||
- Fix context menu outside screen [Taiga #5524](https://tree.taiga.io/project/penpot/issue/5524)
|
- Fix context menu outside screen [Taiga #5524](https://tree.taiga.io/project/penpot/issue/5524)
|
||||||
- Fix graphic item rename on assets pannel [Taiga #5556](https://tree.taiga.io/project/penpot/issue/5556)
|
- Fix graphic item rename on assets pannel [Taiga #5556](https://tree.taiga.io/project/penpot/issue/5556)
|
||||||
|
- Fix component and media name validation on assets panel [Taiga #5555](https://tree.taiga.io/project/penpot/issue/5555)
|
||||||
|
|
||||||
### :heart: Community contributions by (Thank you!)
|
### :heart: Community contributions by (Thank you!)
|
||||||
|
|
||||||
|
|
|
@ -185,21 +185,22 @@
|
||||||
|
|
||||||
(defn rename-media
|
(defn rename-media
|
||||||
[id new-name]
|
[id new-name]
|
||||||
(dm/assert! (uuid? id))
|
(dm/verify! (uuid? id))
|
||||||
(dm/assert! (string? new-name))
|
(dm/verify! (string? new-name))
|
||||||
(ptk/reify ::rename-media
|
(ptk/reify ::rename-media
|
||||||
ptk/WatchEvent
|
ptk/WatchEvent
|
||||||
(watch [it state _]
|
(watch [it state _]
|
||||||
(when (and (some? new-name) (not= "" new-name))
|
(let [new-name (str/trim new-name)]
|
||||||
(let [data (get state :workspace-data)
|
(if (str/empty? new-name)
|
||||||
[path name] (cph/parse-path-name new-name)
|
(rx/empty)
|
||||||
object (get-in data [:media id])
|
(let [[path name] (cph/parse-path-name new-name)
|
||||||
new-object (assoc object :path path :name name)
|
data (get state :workspace-data)
|
||||||
changes (-> (pcb/empty-changes it)
|
object (get-in data [:media id])
|
||||||
(pcb/with-library-data data)
|
new-object (assoc object :path path :name name)
|
||||||
(pcb/update-media new-object))]
|
changes (-> (pcb/empty-changes it)
|
||||||
(rx/of (dch/commit-changes changes)))))))
|
(pcb/with-library-data data)
|
||||||
|
(pcb/update-media new-object))]
|
||||||
|
(rx/of (dch/commit-changes changes))))))))
|
||||||
|
|
||||||
(defn delete-media
|
(defn delete-media
|
||||||
[{:keys [id] :as params}]
|
[{:keys [id] :as params}]
|
||||||
|
|
Loading…
Add table
Reference in a new issue