mirror of
https://github.com/penpot/penpot.git
synced 2025-01-08 16:00:19 -05:00
🐛 Fix undo when updating several texts
This commit is contained in:
parent
e9819ab063
commit
53b4c6383b
3 changed files with 21 additions and 7 deletions
|
@ -81,6 +81,7 @@
|
||||||
- Fix exports menu on viewer mode [Taiga #5568](https://tree.taiga.io/project/penpot/issue/5568)
|
- Fix exports menu on viewer mode [Taiga #5568](https://tree.taiga.io/project/penpot/issue/5568)
|
||||||
- Fix create empty comments [Taiga #5536](https://tree.taiga.io/project/penpot/issue/5536)
|
- Fix create empty comments [Taiga #5536](https://tree.taiga.io/project/penpot/issue/5536)
|
||||||
- Fix position of text cursor is a bit too high in Invitations section [Taiga #5511](https://tree.taiga.io/project/penpot/issue/5511)
|
- Fix position of text cursor is a bit too high in Invitations section [Taiga #5511](https://tree.taiga.io/project/penpot/issue/5511)
|
||||||
|
- Fix undo when updating several texts [Taiga #5197](https://tree.taiga.io/project/penpot/issue/5197)
|
||||||
|
|
||||||
### :arrow_up: Deps updates
|
### :arrow_up: Deps updates
|
||||||
|
|
||||||
|
|
|
@ -627,6 +627,18 @@
|
||||||
(rx/of (update-text-attrs {:id id :attrs attrs}))
|
(rx/of (update-text-attrs {:id id :attrs attrs}))
|
||||||
(rx/empty)))))))
|
(rx/empty)))))))
|
||||||
|
|
||||||
|
(defn update-all-attrs
|
||||||
|
[ids attrs]
|
||||||
|
(ptk/reify ::update-all-attrs
|
||||||
|
ptk/WatchEvent
|
||||||
|
(watch [_ _ _]
|
||||||
|
(let [undo-id (js/Symbol)]
|
||||||
|
(rx/concat
|
||||||
|
(rx/of (dwu/start-undo-transaction undo-id))
|
||||||
|
(->> (rx/from ids)
|
||||||
|
(rx/map #(update-attrs % attrs)))
|
||||||
|
(rx/of (dwu/commit-undo-transaction undo-id)))))))
|
||||||
|
|
||||||
|
|
||||||
(defn apply-typography
|
(defn apply-typography
|
||||||
"A higher level event that has the resposability of to apply the
|
"A higher level event that has the resposability of to apply the
|
||||||
|
|
|
@ -172,16 +172,16 @@
|
||||||
emit-update!
|
emit-update!
|
||||||
(mf/use-callback
|
(mf/use-callback
|
||||||
(mf/deps values)
|
(mf/deps values)
|
||||||
(fn [id attrs]
|
(fn [ids attrs]
|
||||||
(st/emit! (dwt/save-font (-> (merge txt/default-text-attrs values attrs)
|
(st/emit! (dwt/save-font (-> (merge txt/default-text-attrs values attrs)
|
||||||
(select-keys dwt/text-attrs)))
|
(select-keys dwt/text-attrs)))
|
||||||
(dwt/update-attrs id attrs))))
|
(dwt/update-all-attrs ids attrs))))
|
||||||
|
|
||||||
on-change
|
on-change
|
||||||
(mf/use-callback
|
(mf/use-callback
|
||||||
(mf/deps ids emit-update!)
|
(mf/deps ids emit-update!)
|
||||||
(fn [attrs]
|
(fn [attrs]
|
||||||
(run! #(emit-update! % attrs) ids)))
|
(emit-update! ids attrs)))
|
||||||
|
|
||||||
typography
|
typography
|
||||||
(mf/use-memo
|
(mf/use-memo
|
||||||
|
@ -211,8 +211,9 @@
|
||||||
typography (dwt/generate-typography-name typography)
|
typography (dwt/generate-typography-name typography)
|
||||||
id (uuid/next)]
|
id (uuid/next)]
|
||||||
(st/emit! (dwl/add-typography (assoc typography :id id) false))
|
(st/emit! (dwl/add-typography (assoc typography :id id) false))
|
||||||
(run! #(emit-update! % {:typography-ref-id id
|
(emit-update! ids
|
||||||
:typography-ref-file file-id}) ids)))
|
{:typography-ref-id id
|
||||||
|
:typography-ref-file file-id})))
|
||||||
|
|
||||||
handle-detach-typography
|
handle-detach-typography
|
||||||
(mf/use-callback
|
(mf/use-callback
|
||||||
|
|
Loading…
Reference in a new issue