mirror of
https://github.com/penpot/penpot.git
synced 2025-12-12 06:24:17 +01:00
🐛 Add migration for properly decode all position data on text shapes
This commit is contained in:
committed by
Alonso Torres
parent
8954b05d76
commit
59f7ede4ff
@@ -6,22 +6,24 @@
|
|||||||
|
|
||||||
(ns user
|
(ns user
|
||||||
(:require
|
(:require
|
||||||
|
[app.binfile.common :as bfc]
|
||||||
[app.common.data :as d]
|
[app.common.data :as d]
|
||||||
[app.common.debug :as debug]
|
[app.common.debug :as debug]
|
||||||
[app.common.exceptions :as ex]
|
[app.common.exceptions :as ex]
|
||||||
[app.common.files.helpers :as cfh]
|
[app.common.files.helpers :as cfh]
|
||||||
[app.common.fressian :as fres]
|
[app.common.fressian :as fres]
|
||||||
[app.common.geom.matrix :as gmt]
|
[app.common.geom.matrix :as gmt]
|
||||||
|
[app.common.json :as json]
|
||||||
[app.common.logging :as l]
|
[app.common.logging :as l]
|
||||||
[app.common.perf :as perf]
|
[app.common.perf :as perf]
|
||||||
[app.common.pprint :as pp]
|
[app.common.pprint :as pp]
|
||||||
[app.common.schema :as sm]
|
[app.common.schema :as sm]
|
||||||
[app.common.schema.desc-js-like :as smdj]
|
[app.common.schema.desc-js-like :as smdj]
|
||||||
[app.common.schema.desc-native :as smdn]
|
[app.common.schema.desc-native :as smdn]
|
||||||
[app.common.schema.openapi :as oapi]
|
|
||||||
[app.common.schema.generators :as sg]
|
[app.common.schema.generators :as sg]
|
||||||
|
[app.common.schema.openapi :as oapi]
|
||||||
[app.common.spec :as us]
|
[app.common.spec :as us]
|
||||||
[app.common.json :as json]
|
[app.common.time :as ct]
|
||||||
[app.common.transit :as t]
|
[app.common.transit :as t]
|
||||||
[app.common.types.file :as ctf]
|
[app.common.types.file :as ctf]
|
||||||
[app.common.uuid :as uuid]
|
[app.common.uuid :as uuid]
|
||||||
@@ -31,7 +33,6 @@
|
|||||||
[app.srepl.helpers :as srepl.helpers]
|
[app.srepl.helpers :as srepl.helpers]
|
||||||
[app.srepl.main :as srepl]
|
[app.srepl.main :as srepl]
|
||||||
[app.util.blob :as blob]
|
[app.util.blob :as blob]
|
||||||
[app.common.time :as ct]
|
|
||||||
[clj-async-profiler.core :as prof]
|
[clj-async-profiler.core :as prof]
|
||||||
[clojure.contrib.humanize :as hum]
|
[clojure.contrib.humanize :as hum]
|
||||||
[clojure.java.io :as io]
|
[clojure.java.io :as io]
|
||||||
|
|||||||
@@ -31,6 +31,7 @@
|
|||||||
[app.common.types.shape :as cts]
|
[app.common.types.shape :as cts]
|
||||||
[app.common.types.shape.interactions :as ctsi]
|
[app.common.types.shape.interactions :as ctsi]
|
||||||
[app.common.types.shape.shadow :as ctss]
|
[app.common.types.shape.shadow :as ctss]
|
||||||
|
[app.common.types.shape.text :as ctst]
|
||||||
[app.common.types.text :as types.text]
|
[app.common.types.text :as types.text]
|
||||||
[app.common.uuid :as uuid]
|
[app.common.uuid :as uuid]
|
||||||
[clojure.set :as set]
|
[clojure.set :as set]
|
||||||
@@ -1585,6 +1586,25 @@
|
|||||||
(-> data
|
(-> data
|
||||||
(update :pages-index d/update-vals update-page))))
|
(update :pages-index d/update-vals update-page))))
|
||||||
|
|
||||||
|
(defmethod migrate-data "0012-fix-position-data"
|
||||||
|
[data _]
|
||||||
|
(let [decode-fn
|
||||||
|
(sm/decoder ctst/schema:position-data sm/json-transformer)
|
||||||
|
|
||||||
|
update-object
|
||||||
|
(fn [object]
|
||||||
|
(if (cfh/text-shape? object)
|
||||||
|
(d/update-when object :position-data decode-fn)
|
||||||
|
object))
|
||||||
|
|
||||||
|
update-container
|
||||||
|
(fn [container]
|
||||||
|
(d/update-when container :objects d/update-vals update-object))]
|
||||||
|
|
||||||
|
(-> data
|
||||||
|
(update :pages-index d/update-vals update-container)
|
||||||
|
(d/update-when :components d/update-vals update-container))))
|
||||||
|
|
||||||
(def available-migrations
|
(def available-migrations
|
||||||
(into (d/ordered-set)
|
(into (d/ordered-set)
|
||||||
["legacy-2"
|
["legacy-2"
|
||||||
@@ -1652,4 +1672,5 @@
|
|||||||
"0009-clean-library-colors"
|
"0009-clean-library-colors"
|
||||||
"0009-add-partial-text-touched-flags"
|
"0009-add-partial-text-touched-flags"
|
||||||
"0010-fix-swap-slots-pointing-non-existent-shapes"
|
"0010-fix-swap-slots-pointing-non-existent-shapes"
|
||||||
"0011-fix-invalid-text-touched-flags"]))
|
"0011-fix-invalid-text-touched-flags"
|
||||||
|
"0012-fix-position-data"]))
|
||||||
|
|||||||
Reference in New Issue
Block a user