mirror of
https://github.com/penpot/penpot.git
synced 2025-01-10 00:40:30 -05:00
🐛 Fix issue when typography name is empty.
This commit is contained in:
parent
9ee5a3159c
commit
e44ea47497
3 changed files with 15 additions and 6 deletions
|
@ -441,7 +441,7 @@
|
||||||
[path-name]
|
[path-name]
|
||||||
(let [path-name-split (split-path path-name)
|
(let [path-name-split (split-path path-name)
|
||||||
path (str/join " / " (butlast path-name-split))
|
path (str/join " / " (butlast path-name-split))
|
||||||
name (last path-name-split)]
|
name (or (last path-name-split) "")]
|
||||||
[path name]))
|
[path name]))
|
||||||
|
|
||||||
(defn merge-path-item
|
(defn merge-path-item
|
||||||
|
|
|
@ -48,3 +48,12 @@
|
||||||
[:a :b :c :d]))
|
[:a :b :c :d]))
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
(t/deftest parse-path-name
|
||||||
|
(t/is (= ["foo" "bar"] (cph/parse-path-name "foo/bar")))
|
||||||
|
(t/is (= ["" "foo"] (cph/parse-path-name "foo")))
|
||||||
|
(t/is (= ["" "foo"] (cph/parse-path-name "/foo")))
|
||||||
|
(t/is (= ["" ""] (cph/parse-path-name "")))
|
||||||
|
(t/is (= ["" ""] (cph/parse-path-name nil)))
|
||||||
|
)
|
||||||
|
|
|
@ -242,11 +242,11 @@
|
||||||
(watch [it state _]
|
(watch [it state _]
|
||||||
(let [[path name] (cp/parse-path-name (:name typography))
|
(let [[path name] (cp/parse-path-name (:name typography))
|
||||||
typography (assoc typography :path path :name name)
|
typography (assoc typography :path path :name name)
|
||||||
prev (get-in state [:workspace-data :typographies (:id typography)])
|
prev (get-in state [:workspace-data :typographies (:id typography)])
|
||||||
rchg {:type :mod-typography
|
rchg {:type :mod-typography
|
||||||
:typography typography}
|
:typography typography}
|
||||||
uchg {:type :mod-typography
|
uchg {:type :mod-typography
|
||||||
:typography prev}]
|
:typography prev}]
|
||||||
(rx/of (dwu/start-undo-transaction)
|
(rx/of (dwu/start-undo-transaction)
|
||||||
(dch/commit-changes {:redo-changes [rchg]
|
(dch/commit-changes {:redo-changes [rchg]
|
||||||
:undo-changes [uchg]
|
:undo-changes [uchg]
|
||||||
|
|
Loading…
Reference in a new issue