mirror of
https://github.com/penpot/penpot.git
synced 2026-08-28 07:38:42 +00:00
🐛 Fix problem with viewer texts
This commit is contained in:
parent
24fe5559c5
commit
b2bfd627ae
@ -214,6 +214,11 @@ test("Multiselection of text and typographies", async ({ page }) => {
|
|||||||
pageId: "1062e0a0-8fe0-80ae-8007-e70b4993f5f0",
|
pageId: "1062e0a0-8fe0-80ae-8007-e70b4993f5f0",
|
||||||
});
|
});
|
||||||
|
|
||||||
|
await workspacePage.mockRPC(
|
||||||
|
"update-file?id=*",
|
||||||
|
"workspace/update-file-empty.json",
|
||||||
|
);
|
||||||
|
|
||||||
const plainTextLayer = workspacePage.layers.getByTestId("layer-row").nth(5);
|
const plainTextLayer = workspacePage.layers.getByTestId("layer-row").nth(5);
|
||||||
const plainTextLayerTwo = workspacePage.layers
|
const plainTextLayerTwo = workspacePage.layers
|
||||||
.getByTestId("layer-row")
|
.getByTestId("layer-row")
|
||||||
|
|||||||
@ -121,6 +121,11 @@ test("BUG 13385 - Fix viewport not updating when restoring version", async ({ pa
|
|||||||
await workspacePage.mockGetFile("workspace/get-file-13385.json");
|
await workspacePage.mockGetFile("workspace/get-file-13385.json");
|
||||||
await workspacePage.mockRPC("get-profiles-for-file-comments?file-id=*", "workspace/get-profiles-for-file-comments-13385.json");
|
await workspacePage.mockRPC("get-profiles-for-file-comments?file-id=*", "workspace/get-profiles-for-file-comments-13385.json");
|
||||||
|
|
||||||
|
await workspacePage.mockRPC(
|
||||||
|
"update-file?id=*",
|
||||||
|
"workspace/update-file-empty.json",
|
||||||
|
);
|
||||||
|
|
||||||
// navigate to workspace and check that the circle shape is not there
|
// navigate to workspace and check that the circle shape is not there
|
||||||
await workspacePage.goToWorkspace();
|
await workspacePage.goToWorkspace();
|
||||||
await expect(workspacePage.layers.getByText("Ellipse")).not.toBeVisible();
|
await expect(workspacePage.layers.getByText("Ellipse")).not.toBeVisible();
|
||||||
@ -141,4 +146,4 @@ test("BUG 13385 - Fix viewport not updating when restoring version", async ({ pa
|
|||||||
|
|
||||||
// assert that the circle shape exists
|
// assert that the circle shape exists
|
||||||
await expect(workspacePage.layers.getByText("Ellipse")).toBeVisible();
|
await expect(workspacePage.layers.getByText("Ellipse")).toBeVisible();
|
||||||
});
|
});
|
||||||
|
|||||||
@ -203,6 +203,38 @@
|
|||||||
(rx/of (ptk/data-event ::all-libraries-resolved {:file-id file-id})))
|
(rx/of (ptk/data-event ::all-libraries-resolved {:file-id file-id})))
|
||||||
(rx/take-until stopper-s))))))
|
(rx/take-until stopper-s))))))
|
||||||
|
|
||||||
|
|
||||||
|
(defn check-file-position-data
|
||||||
|
[file-id]
|
||||||
|
(ptk/reify ::fix-position-data
|
||||||
|
ptk/WatchEvent
|
||||||
|
(watch [it state _]
|
||||||
|
(let [file (dsh/lookup-file state file-id)
|
||||||
|
changes
|
||||||
|
(->> file :data :pages
|
||||||
|
(mapcat
|
||||||
|
(fn [page-id]
|
||||||
|
(->> (dsh/lookup-page-objects state file-id page-id)
|
||||||
|
(vals)
|
||||||
|
(filter cfh/text-shape?)
|
||||||
|
(filter #(nil? (:position-data %)))
|
||||||
|
(map (fn [shape]
|
||||||
|
{:type :mod-obj
|
||||||
|
:id (:id shape)
|
||||||
|
:page-id page-id
|
||||||
|
:operations
|
||||||
|
[{:type :set
|
||||||
|
:attr :position-data
|
||||||
|
:val (wasm.api/calculate-position-data shape)
|
||||||
|
:ignore-touched true
|
||||||
|
:ignore-geometry true}]})))))
|
||||||
|
(into []))]
|
||||||
|
(rx/of (dch/commit-changes
|
||||||
|
{:redo-changes changes :undo-changes []
|
||||||
|
:save-undo? false
|
||||||
|
:origin it
|
||||||
|
:tags #{:position-data}}))))))
|
||||||
|
|
||||||
(defn- workspace-initialized
|
(defn- workspace-initialized
|
||||||
[file-id]
|
[file-id]
|
||||||
(ptk/reify ::workspace-initialized
|
(ptk/reify ::workspace-initialized
|
||||||
|
|||||||
@ -17,6 +17,7 @@
|
|||||||
[app.common.types.shape :as cts]
|
[app.common.types.shape :as cts]
|
||||||
[app.common.types.shape.layout :as ctl]
|
[app.common.types.shape.layout :as ctl]
|
||||||
[app.main.data.modal :as modal]
|
[app.main.data.modal :as modal]
|
||||||
|
[app.main.data.workspace :as dw]
|
||||||
[app.main.data.workspace.transforms :as dwt]
|
[app.main.data.workspace.transforms :as dwt]
|
||||||
[app.main.data.workspace.variants :as dwv]
|
[app.main.data.workspace.variants :as dwv]
|
||||||
[app.main.features :as features]
|
[app.main.features :as features]
|
||||||
@ -455,7 +456,10 @@
|
|||||||
;; blank canvas (first load) visible while shapes load.
|
;; blank canvas (first load) visible while shapes load.
|
||||||
;; The loading overlay is suppressed because on-shapes-ready
|
;; The loading overlay is suppressed because on-shapes-ready
|
||||||
;; is set.
|
;; is set.
|
||||||
(wasm.api/initialize-viewport base-objects zoom vbox :background background)
|
(wasm.api/initialize-viewport base-objects zoom vbox
|
||||||
|
:background background
|
||||||
|
:on-shapes-ready
|
||||||
|
#(st/emit! (dw/check-file-position-data file-id)))
|
||||||
(reset! initialized? true))
|
(reset! initialized? true))
|
||||||
|
|
||||||
(when (and (some? vern) (not= vern (mf/ref-val last-vern-ref)))
|
(when (and (some? vern) (not= vern (mf/ref-val last-vern-ref)))
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user