0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-22 14:39:45 -05:00

🐛 Fix rename typography on text options

This commit is contained in:
alonso.torres 2021-08-31 12:56:03 +02:00
parent f44675a1e4
commit 885d7de11b
2 changed files with 19 additions and 2 deletions

View file

@ -23,6 +23,7 @@
- Fix problem with borders on shape export [#1092](https://github.com/penpot/penpot/issues/1092)
- Fix thumbnail cropping issue [Taiga #1964](https://tree.taiga.io/project/penpot/issue/1964)
- Fix repeated fetch on file selection [Taiga #1933](https://tree.taiga.io/project/penpot/issue/1933)
- Fix rename typography on text options [Taiga #1963](https://tree.taiga.io/project/penpot/issue/1963)
### :arrow_up: Deps updates
### :boom: Breaking changes

View file

@ -437,6 +437,8 @@
hover-detach (mf/use-state false)
name-input-ref (mf/use-ref)
name-ref (mf/use-ref (:name typography))
on-name-blur
(fn [event]
(let [content (dom/get-target-val event)]
@ -447,7 +449,12 @@
(fn []
(let [pparams {:project-id (:project-id file)
:file-id (:id file)}]
(st/emit! (rt/nav :workspace pparams))))]
(st/emit! (rt/nav :workspace pparams))))
on-name-change
(mf/use-callback
(fn [event]
(mf/set-ref-val! name-ref (dom/get-target-val event))))]
(mf/use-effect
(mf/deps editting?)
@ -464,6 +471,14 @@
(dom/focus! node)
(dom/select-text! node))))))
(mf/use-effect
(fn []
(fn []
(let [content (mf/ref-val name-ref)]
;; On destroy we check if it changed
(when (and (some? content) (not= content (:name typography)))
(on-change {:name content}))))))
[:*
[:div.element-set-options-group.typography-entry
{:class (when selected? "selected")
@ -536,7 +551,8 @@
{:type "text"
:ref name-input-ref
:default-value (cp/merge-path-item (:path typography) (:name typography))
:on-blur on-name-blur}]
:on-blur on-name-blur
:on-change on-name-change}]
[:div.element-set-actions-button
{:on-click #(reset! open? false)}