mirror of
https://github.com/penpot/penpot.git
synced 2026-05-20 15:33:43 +00:00
🐛 Fix editing a text element detaches applied tokens (#9525)
This commit is contained in:
parent
1ac503f6bc
commit
25ee8dee78
@ -123,6 +123,7 @@
|
||||
- Fix several color picker issues [#9556](https://github.com/penpot/penpot/issues/9556) (PR: [#9558](https://github.com/penpot/penpot/pull/9558))
|
||||
- Fix asset icon broken on Asset tab [#9587](https://github.com/penpot/penpot/issues/9587) (PR: [#9612](https://github.com/penpot/penpot/pull/9612))
|
||||
- Fix text fill color stops updating in multiselect with texts [#9608](https://github.com/penpot/penpot/issues/9608) (PR: [#9549](https://github.com/penpot/penpot/pull/9549))
|
||||
- Fix editing a legacy text element silently detaches its color token [Taiga #13958](https://tree.taiga.io/project/penpot/issue/13958)
|
||||
|
||||
## 2.15.4 (Unreleased)
|
||||
|
||||
|
||||
@ -177,7 +177,9 @@
|
||||
|
||||
(defn not-empty?
|
||||
[coll]
|
||||
(boolean (seq coll)))
|
||||
(if (coll? coll)
|
||||
(boolean (seq coll))
|
||||
(not (nil? coll))))
|
||||
|
||||
(defn editable-collection?
|
||||
[m]
|
||||
|
||||
@ -242,8 +242,11 @@
|
||||
acc)
|
||||
|
||||
:else
|
||||
;; If the key is not :text, and they are different, it is an attribute differece
|
||||
(if (not= v1 v2)
|
||||
;; If the key is not :text, and they are different, it is an attribute difference.
|
||||
;; Take into account that some processes remove empty attributes, so in some
|
||||
;; cases we will compare [] with nil, and this is not a difference.
|
||||
(if (and (not= v1 v2)
|
||||
(or (d/not-empty? v1) (d/not-empty? v2)))
|
||||
(attribute-cb acc k)
|
||||
acc))))
|
||||
#{}
|
||||
|
||||
4321
frontend/playwright/data/workspace/get-file-13958.json
Normal file
4321
frontend/playwright/data/workspace/get-file-13958.json
Normal file
File diff suppressed because one or more lines are too long
29
frontend/playwright/ui/specs/tokens/text.spec.js
Normal file
29
frontend/playwright/ui/specs/tokens/text.spec.js
Normal file
@ -0,0 +1,29 @@
|
||||
import { test, expect } from "@playwright/test";
|
||||
import { WasmWorkspacePage } from "../../pages/WasmWorkspacePage";
|
||||
|
||||
test.beforeEach(async ({ page }) => {
|
||||
await WasmWorkspacePage.init(page);
|
||||
});
|
||||
|
||||
test("BUG 13958 - Fill token gets detached when editing text shape", async ({ page }) => {
|
||||
const workspacePage = new WasmWorkspacePage(page);
|
||||
await workspacePage.setupEmptyFile();
|
||||
// Load a file that has a text shape, whose content contains a `:fills []` in the root node.
|
||||
// This attribute is removed when editing the text, causing the old code to detect that the
|
||||
// fills had changed and detaching the token.
|
||||
await workspacePage.mockGetFile("workspace/get-file-13958.json");
|
||||
await workspacePage.goToWorkspace();
|
||||
|
||||
// Check token is attached to the shape
|
||||
await workspacePage.clickLeafLayer("Design tokens are a set");
|
||||
await expect(workspacePage.rightSidebar.getByLabel("xx.alias.color.text.default", { exact: true })).toBeVisible();
|
||||
|
||||
// Enter and exit the text editor
|
||||
await workspacePage.page.keyboard.press("Enter");
|
||||
await expect(workspacePage.page.getByTestId("text-editor")).toBeVisible();
|
||||
await workspacePage.page.keyboard.press("Escape");
|
||||
await expect(workspacePage.page.getByTestId("text-editor")).not.toBeAttached();
|
||||
|
||||
// Assert token is still attached to the shape
|
||||
await expect(workspacePage.rightSidebar.getByLabel("xx.alias.color.text.default", { exact: true })).toBeVisible();
|
||||
});
|
||||
Loading…
x
Reference in New Issue
Block a user