mirror of
https://github.com/penpot/penpot.git
synced 2025-05-07 12:05:55 +02:00
🐛 Disable empty names on rename files
This commit is contained in:
parent
43fe2390c8
commit
a98ae69a03
4 changed files with 17 additions and 8 deletions
|
@ -67,6 +67,7 @@
|
||||||
- Fix problem with selection colors and texts [Taiga #5079](https://tree.taiga.io/project/penpot/issue/5079)
|
- Fix problem with selection colors and texts [Taiga #5079](https://tree.taiga.io/project/penpot/issue/5079)
|
||||||
- Remove "show in view mode" flag when moving frame to frame [Taiga #5091](https://tree.taiga.io/project/penpot/issue/5091)
|
- Remove "show in view mode" flag when moving frame to frame [Taiga #5091](https://tree.taiga.io/project/penpot/issue/5091)
|
||||||
- Fix problem creating files in project page [Taiga #5060](https://tree.taiga.io/project/penpot/issue/5060)
|
- Fix problem creating files in project page [Taiga #5060](https://tree.taiga.io/project/penpot/issue/5060)
|
||||||
|
- Disable empty names on rename files [Taiga #5088](https://tree.taiga.io/project/penpot/issue/5088)
|
||||||
|
|
||||||
### :heart: Community contributions by (Thank you!)
|
### :heart: Community contributions by (Thank you!)
|
||||||
- To @ondrejkonec: for contributing to the code with:
|
- To @ondrejkonec: for contributing to the code with:
|
||||||
|
|
|
@ -268,7 +268,9 @@
|
||||||
(mf/use-fn
|
(mf/use-fn
|
||||||
(mf/deps file)
|
(mf/deps file)
|
||||||
(fn [name]
|
(fn [name]
|
||||||
(st/emit! (dd/rename-file (assoc file :name name)))
|
(let [name (str/trim name)]
|
||||||
|
(when (not= name "")
|
||||||
|
(st/emit! (dd/rename-file (assoc file :name name)))))
|
||||||
(swap! local assoc :edition false)))
|
(swap! local assoc :edition false)))
|
||||||
|
|
||||||
on-edit
|
on-edit
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
[app.util.keyboard :as kbd]
|
[app.util.keyboard :as kbd]
|
||||||
[app.util.webapi :as wapi]
|
[app.util.webapi :as wapi]
|
||||||
[beicon.core :as rx]
|
[beicon.core :as rx]
|
||||||
|
[cuerdas.core :as str]
|
||||||
[potok.core :as ptk]
|
[potok.core :as ptk]
|
||||||
[rumext.v2 :as mf]))
|
[rumext.v2 :as mf]))
|
||||||
|
|
||||||
|
@ -61,9 +62,11 @@
|
||||||
(->> files
|
(->> files
|
||||||
(mapv
|
(mapv
|
||||||
(fn [file]
|
(fn [file]
|
||||||
(cond-> file
|
(let [new-name (str/trim new-name)]
|
||||||
(= (:file-id file) file-id)
|
(cond-> file
|
||||||
(assoc :name new-name))))))
|
(and (= (:file-id file) file-id)
|
||||||
|
(not= "" new-name))
|
||||||
|
(assoc :name new-name)))))))
|
||||||
|
|
||||||
(defn remove-file [files file-id]
|
(defn remove-file [files file-id]
|
||||||
(->> files
|
(->> files
|
||||||
|
|
|
@ -33,6 +33,7 @@
|
||||||
[app.util.keyboard :as kbd]
|
[app.util.keyboard :as kbd]
|
||||||
[app.util.router :as rt]
|
[app.util.router :as rt]
|
||||||
[beicon.core :as rx]
|
[beicon.core :as rx]
|
||||||
|
[cuerdas.core :as str]
|
||||||
[okulary.core :as l]
|
[okulary.core :as l]
|
||||||
[potok.core :as ptk]
|
[potok.core :as ptk]
|
||||||
[rumext.v2 :as mf]))
|
[rumext.v2 :as mf]))
|
||||||
|
@ -150,10 +151,12 @@
|
||||||
:on-accept #(st/emit! (dwl/set-file-shared (:id file) false))
|
:on-accept #(st/emit! (dwl/set-file-shared (:id file) false))
|
||||||
:count-libraries 1}))))
|
:count-libraries 1}))))
|
||||||
|
|
||||||
handle-blur (fn [_]
|
handle-blur
|
||||||
(let [value (-> edit-input-ref mf/ref-val dom/get-value)]
|
(fn [_]
|
||||||
(st/emit! (dw/rename-file (:id file) value)))
|
(let [value (str/trim (-> edit-input-ref mf/ref-val dom/get-value))]
|
||||||
(reset! editing? false))
|
(when (not= value "")
|
||||||
|
(st/emit! (dw/rename-file (:id file) value))))
|
||||||
|
(reset! editing? false))
|
||||||
|
|
||||||
handle-name-keydown (fn [event]
|
handle-name-keydown (fn [event]
|
||||||
(when (kbd/enter? event)
|
(when (kbd/enter? event)
|
||||||
|
|
Loading…
Add table
Reference in a new issue