Backport and merge migrations from staging (#5681)

This commit is contained in:
Andrey Antukh 2025-01-24 19:11:03 +01:00 committed by GitHub
parent 48132711b6
commit 71560c0a53
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 64 additions and 19 deletions

View file

@ -29,7 +29,8 @@
- Fix errors from editable select on measures menu [Taiga #9888](https://tree.taiga.io/project/penpot/issue/9888) - Fix errors from editable select on measures menu [Taiga #9888](https://tree.taiga.io/project/penpot/issue/9888)
- Fix exception on importing some templates from templates slider - Fix exception on importing some templates from templates slider
- Consolidate adding share button to workspace
- Fix problem when pasting text [Taiga #9929](https://tree.taiga.io/project/penpot/issue/9929)
## 2.4.2 ## 2.4.2

View file

@ -6,4 +6,4 @@
(ns app.common.files.defaults) (ns app.common.files.defaults)
(def version 61) (def version 64)

View file

@ -25,6 +25,7 @@
[app.common.text :as txt] [app.common.text :as txt]
[app.common.types.color :as ctc] [app.common.types.color :as ctc]
[app.common.types.component :as ctk] [app.common.types.component :as ctk]
[app.common.types.container :as ctn]
[app.common.types.file :as ctf] [app.common.types.file :as ctf]
[app.common.types.shape :as cts] [app.common.types.shape :as cts]
[app.common.types.shape.shadow :as ctss] [app.common.types.shape.shadow :as ctss]
@ -1145,7 +1146,40 @@
(update :pages-index update-vals update-container) (update :pages-index update-vals update-container)
(update :components update-vals update-container)))) (update :components update-vals update-container))))
(defn migrate-up-60 (defn migrate-up-62
[data]
(let [xform-cycles-ids
(comp (filter #(= (:id %) (:shape-ref %)))
(map :id))
remove-cycles
(fn [objects]
(let [cycles-ids (into #{} xform-cycles-ids (vals objects))
to-detach (->> cycles-ids
(map #(get objects %))
(map #(ctn/get-head-shape objects %))
(map :id)
distinct
(mapcat #(ctn/get-children-in-instance objects %))
(map :id)
set)]
(reduce-kv (fn [objects id shape]
(if (contains? to-detach id)
(assoc objects id (ctk/detach-shape shape))
objects))
objects
objects)))
update-component
(fn [component]
;; we only have encounter this on deleted components,
;; so the relevant objects are inside the component
(d/update-when component :objects remove-cycles))]
(update data :components update-vals update-component)))
(defn migrate-up-63
[data] [data]
(letfn [(update-object [object] (letfn [(update-object [object]
(if (and (:rx object) (not (:r1 object))) (if (and (:rx object) (not (:r1 object)))
@ -1163,7 +1197,7 @@
(update :pages-index update-vals update-container) (update :pages-index update-vals update-container)
(update :components update-vals update-container)))) (update :components update-vals update-container))))
(defn migrate-up-61 (defn migrate-up-64
[data] [data]
(letfn [(update-object [object] (letfn [(update-object [object]
(d/update-when object :shadow #(into [] (reverse %)))) (d/update-when object :shadow #(into [] (reverse %))))
@ -1225,6 +1259,6 @@
{:id 56 :migrate-up migrate-up-56} {:id 56 :migrate-up migrate-up-56}
{:id 57 :migrate-up migrate-up-57} {:id 57 :migrate-up migrate-up-57}
{:id 59 :migrate-up migrate-up-59} {:id 59 :migrate-up migrate-up-59}
{:id 60 :migrate-up migrate-up-60} {:id 62 :migrate-up migrate-up-62}
{:id 61 :migrate-up migrate-up-61}]) {:id 63 :migrate-up migrate-up-63}
{:id 64 :migrate-up migrate-up-64}])

View file

@ -307,3 +307,16 @@ test("Copy/paste properties", async ({ page, context }) => {
await page.getByText("Copy/Paste as").hover(); await page.getByText("Copy/Paste as").hover();
await page.getByText("Paste properties").click(); await page.getByText("Paste properties").click();
}); });
test("[Taiga #9929] Paste text in workspace", async ({ page, context }) => {
const workspacePage = new WorkspacePage(page);
await workspacePage.setupEmptyFile(page);
await workspacePage.goToWorkspace();
await context.grantPermissions(["clipboard-read", "clipboard-write"]);
await page.evaluate(() => navigator.clipboard.writeText("Lorem ipsum dolor"));
await workspacePage.viewport.click({ button: "right" });
await page.getByText("PasteCtrlV").click();
await workspacePage.viewport
.getByRole("textbox")
.getByText("Lorem ipsum dolor");
});

View file

@ -1506,10 +1506,10 @@
(coll? transit-data) (coll? transit-data)
(rx/of (paste-transit-shapes (assoc transit-data :in-viewport in-viewport?))) (rx/of (paste-transit-shapes (assoc transit-data :in-viewport in-viewport?)))
(string? html-data) (and (string? html-data) (d/not-empty? html-data))
(rx/of (paste-html-text html-data text-data)) (rx/of (paste-html-text html-data text-data))
(string? text-data) (and (string? text-data) (d/not-empty? text-data))
(rx/of (paste-text text-data)) (rx/of (paste-text text-data))
:else :else

View file

@ -7,7 +7,6 @@
(ns app.main.ui.workspace.right-header (ns app.main.ui.workspace.right-header
(:require-macros [app.main.style :as stl]) (:require-macros [app.main.style :as stl])
(:require (:require
[app.config :as cf]
[app.main.data.common :as dcm] [app.main.data.common :as dcm]
[app.main.data.event :as ev] [app.main.data.event :as ev]
[app.main.data.modal :as modal] [app.main.data.modal :as modal]
@ -251,9 +250,7 @@
:on-click toggle-history} :on-click toggle-history}
i/history]]) i/history]])
(when (and (when (not (:is-default team))
(not (:is-default team))
(cf/external-feature-flag "share-01" "test"))
[:a {:class (stl/css :viewer-btn) [:a {:class (stl/css :viewer-btn)
:title (tr "workspace.header.share") :title (tr "workspace.header.share")
:on-click open-share-dialog} :on-click open-share-dialog}