mirror of
https://github.com/penpot/penpot.git
synced 2025-02-08 16:18:11 -05:00
🐛 Fix undo on delete page does not preserve its order
This commit is contained in:
parent
469704def6
commit
be656bb4ef
3 changed files with 17 additions and 8 deletions
|
@ -22,6 +22,7 @@
|
||||||
- Fix props preserving on copy&paste texts [Taiga #3629](https://tree.taiga.io/project/penpot/issue/3629) by @andrewzhurov
|
- Fix props preserving on copy&paste texts [Taiga #3629](https://tree.taiga.io/project/penpot/issue/3629) by @andrewzhurov
|
||||||
- Fix unexpected layers ungrouping on moving it [Taiga #3932](https://tree.taiga.io/project/penpot/issue/3932) by @andrewzhurov
|
- Fix unexpected layers ungrouping on moving it [Taiga #3932](https://tree.taiga.io/project/penpot/issue/3932) by @andrewzhurov
|
||||||
- Fix artboards moving with comment tool selected [Taiga #3938](https://tree.taiga.io/project/penpot/issue/3938)
|
- Fix artboards moving with comment tool selected [Taiga #3938](https://tree.taiga.io/project/penpot/issue/3938)
|
||||||
|
- Fix undo on delete page does not preserve its order [Taiga #3375](https://tree.taiga.io/project/penpot/issue/3375)
|
||||||
|
|
||||||
### :arrow_up: Deps updates
|
### :arrow_up: Deps updates
|
||||||
### :heart: Community contributions by (Thank you!)
|
### :heart: Community contributions by (Thank you!)
|
||||||
|
|
|
@ -6,7 +6,8 @@
|
||||||
|
|
||||||
(ns app.common.types.pages-list
|
(ns app.common.types.pages-list
|
||||||
(:require
|
(:require
|
||||||
[app.common.data :as d]))
|
[app.common.data :as d]
|
||||||
|
[app.common.pages.helpers :as cph]))
|
||||||
|
|
||||||
(defn get-page
|
(defn get-page
|
||||||
[file-data id]
|
[file-data id]
|
||||||
|
@ -14,14 +15,18 @@
|
||||||
|
|
||||||
(defn add-page
|
(defn add-page
|
||||||
[file-data page]
|
[file-data page]
|
||||||
(let [; It's legitimate to add a page that is already there,
|
(let [index (:index page)
|
||||||
|
page (dissoc page :index)
|
||||||
|
|
||||||
|
; It's legitimate to add a page that is already there,
|
||||||
; for example in an idempotent changes operation.
|
; for example in an idempotent changes operation.
|
||||||
conj-if-not-exists (fn [pages id]
|
add-if-not-exists (fn [pages id]
|
||||||
(cond-> pages
|
(cond
|
||||||
(not (d/seek #(= % id) pages))
|
(d/seek #(= % id) pages) pages
|
||||||
(conj id)))]
|
(nil? index) (conj pages id)
|
||||||
|
:else (cph/insert-at-index pages index [id])))]
|
||||||
(-> file-data
|
(-> file-data
|
||||||
(update :pages conj-if-not-exists (:id page))
|
(update :pages add-if-not-exists (:id page))
|
||||||
(update :pages-index assoc (:id page) page))))
|
(update :pages-index assoc (:id page) page))))
|
||||||
|
|
||||||
(defn pages-seq
|
(defn pages-seq
|
||||||
|
|
|
@ -326,7 +326,10 @@
|
||||||
(ptk/reify ::delete-page
|
(ptk/reify ::delete-page
|
||||||
ptk/WatchEvent
|
ptk/WatchEvent
|
||||||
(watch [it state _]
|
(watch [it state _]
|
||||||
(let [page (get-in state [:workspace-data :pages-index id])
|
(let [pages (get-in state [:workspace-data :pages])
|
||||||
|
index (d/index-of pages id)
|
||||||
|
page (get-in state [:workspace-data :pages-index id])
|
||||||
|
page (assoc page :index index)
|
||||||
|
|
||||||
changes (-> (pcb/empty-changes it)
|
changes (-> (pcb/empty-changes it)
|
||||||
(pcb/del-page page))]
|
(pcb/del-page page))]
|
||||||
|
|
Loading…
Add table
Reference in a new issue