Merge pull request #8764 from penpot/alotor-fix-issue-text-sizing

🐛 Fix resize text modifiers
This commit is contained in:
Alejandro Alonso
2026-03-25 07:45:25 +01:00
committed by GitHub
4 changed files with 189 additions and 3 deletions

View File

@@ -0,0 +1,19 @@
{
"~:file-id": "~u7fd33337-c651-80ae-8007-c357213f876e",
"~:id": "~u7fd33337-c651-80ae-8007-c3578977e5be",
"~:created-at": "~m1774363460068",
"~:modified-at": "~m1774363460068",
"~:type": "fragment",
"~:backend": "db",
"~:data": {
"~:objects": {
"~#penpot/objects-map/v2": {
"~u00000000-0000-0000-0000-000000000000": "[\"~#shape\",[\"^ \",\"~:y\",0,\"~:hide-fill-on-export\",false,\"~:transform\",[\"~#matrix\",[\"^ \",\"~:a\",1.0,\"~:b\",0.0,\"~:c\",0.0,\"~:d\",1.0,\"~:e\",0.0,\"~:f\",0.0]],\"~:rotation\",0,\"~:name\",\"Root Frame\",\"~:width\",0.01,\"~:type\",\"~:frame\",\"~:points\",[[\"~#point\",[\"^ \",\"~:x\",0.0,\"~:y\",0.0]],[\"^:\",[\"^ \",\"~:x\",0.01,\"~:y\",0.0]],[\"^:\",[\"^ \",\"~:x\",0.01,\"~:y\",0.01]],[\"^:\",[\"^ \",\"~:x\",0.0,\"~:y\",0.01]]],\"~:r2\",0,\"~:proportion-lock\",false,\"~:transform-inverse\",[\"^3\",[\"^ \",\"~:a\",1.0,\"~:b\",0.0,\"~:c\",0.0,\"~:d\",1.0,\"~:e\",0.0,\"~:f\",0.0]],\"~:r3\",0,\"~:r1\",0,\"~:id\",\"~u00000000-0000-0000-0000-000000000000\",\"~:parent-id\",\"~u00000000-0000-0000-0000-000000000000\",\"~:frame-id\",\"~u00000000-0000-0000-0000-000000000000\",\"~:strokes\",[],\"~:x\",0,\"~:proportion\",1.0,\"~:r4\",0,\"~:selrect\",[\"~#rect\",[\"^ \",\"~:x\",0,\"~:y\",0,\"^6\",0.01,\"~:height\",0.01,\"~:x1\",0,\"~:y1\",0,\"~:x2\",0.01,\"~:y2\",0.01]],\"~:fills\",[[\"^ \",\"~:fill-color\",\"#FFFFFF\",\"~:fill-opacity\",1]],\"~:flip-x\",null,\"^H\",0.01,\"~:flip-y\",null,\"~:shapes\",[\"~ub98e38af-59e9-8056-8007-c3577ef85c83\"]]]",
"~ub98e38af-59e9-8056-8007-c35778509984": "[\"~#shape\",[\"^ \",\"~:y\",522.9999389648438,\"~:transform\",[\"~#matrix\",[\"^ \",\"~:a\",1.0,\"~:b\",0.0,\"~:c\",0.0,\"~:d\",1.0,\"~:e\",0.0,\"~:f\",0.0]],\"~:rotation\",0,\"~:grow-type\",\"~:auto-width\",\"~:content\",[\"^ \",\"~:type\",\"root\",\"~:key\",\"lu847h6p2o\",\"~:children\",[[\"^ \",\"^7\",\"paragraph-set\",\"^9\",[[\"^ \",\"~:line-height\",\"1.2\",\"~:font-style\",\"normal\",\"^9\",[[\"^ \",\"^:\",\"1.2\",\"^;\",\"normal\",\"~:typography-ref-id\",null,\"~:text-transform\",\"none\",\"~:font-id\",\"sourcesanspro\",\"^8\",\"20x1m8p51r5\",\"~:font-size\",\"14\",\"~:font-weight\",\"400\",\"~:typography-ref-file\",null,\"~:font-variant-id\",\"regular\",\"~:text-decoration\",\"none\",\"~:letter-spacing\",\"0\",\"~:fills\",[[\"^ \",\"~:fill-color\",\"#000000\",\"~:fill-opacity\",1]],\"~:font-family\",\"sourcesanspro\",\"~:text\",\"uno dos tres cuatro\"]],\"^<\",null,\"^=\",\"none\",\"~:text-align\",\"left\",\"^>\",\"sourcesanspro\",\"^8\",\"5tp2r0veqv\",\"^?\",\"14\",\"^@\",\"400\",\"^A\",null,\"~:text-direction\",\"ltr\",\"^7\",\"paragraph\",\"^B\",\"regular\",\"^C\",\"none\",\"^D\",\"0\",\"^E\",[[\"^ \",\"^F\",\"#000000\",\"^G\",1]],\"^H\",\"sourcesanspro\"]]]],\"~:vertical-align\",\"top\"],\"~:hide-in-viewer\",false,\"~:name\",\"uno dos tres cuatro\",\"~:width\",113,\"^7\",\"^I\",\"~:points\",[[\"~#point\",[\"^ \",\"~:x\",861,\"~:y\",522.9999389648438]],[\"^Q\",[\"^ \",\"~:x\",974,\"~:y\",522.9999389648438]],[\"^Q\",[\"^ \",\"~:x\",974,\"~:y\",539.9999389648438]],[\"^Q\",[\"^ \",\"~:x\",861,\"~:y\",539.9999389648438]]],\"~:transform-inverse\",[\"^2\",[\"^ \",\"~:a\",1.0,\"~:b\",0.0,\"~:c\",0.0,\"~:d\",1.0,\"~:e\",0.0,\"~:f\",0.0]],\"~:id\",\"~ub98e38af-59e9-8056-8007-c35778509984\",\"~:parent-id\",\"~ub98e38af-59e9-8056-8007-c3577ef85c83\",\"~:position-data\",[[\"^ \",\"~:y\",540.659912109375,\"^:\",\"1.2\",\"^;\",\"normal\",\"^=\",\"none\",\"^J\",\"left\",\"^>\",\"sourcesanspro\",\"^?\",\"14\",\"^@\",\"400\",\"^K\",\"ltr\",\"^O\",112.989990234375,\"^B\",\"regular\",\"^C\",\"none\",\"^D\",\"0\",\"~:x\",861,\"^E\",[[\"^ \",\"^F\",\"#000000\",\"^G\",1]],\"~:direction\",\"ltr\",\"^H\",\"sourcesanspro\",\"~:height\",18.1199951171875,\"^I\",\"uno dos tres cuatro\"]],\"~:frame-id\",\"~ub98e38af-59e9-8056-8007-c3577ef85c83\",\"~:x\",861,\"~:selrect\",[\"~#rect\",[\"^ \",\"~:x\",861,\"~:y\",522.9999389648438,\"^O\",113,\"^W\",17,\"~:x1\",861,\"~:y1\",522.9999389648438,\"~:x2\",974,\"~:y2\",539.9999389648438]],\"~:flip-x\",null,\"^W\",17,\"~:flip-y\",null]]",
"~ub98e38af-59e9-8056-8007-c3577ef85c83": "[\"~#shape\",[\"^ \",\"~:y\",512.9999568462372,\"~:hide-fill-on-export\",false,\"~:layout-gap-type\",\"~:multiple\",\"~:layout-padding\",[\"^ \",\"~:p1\",10,\"~:p2\",10,\"~:p3\",10,\"~:p4\",10],\"~:transform\",[\"~#matrix\",[\"^ \",\"~:a\",1.0,\"~:b\",0.0,\"~:c\",0.0,\"~:d\",1.0,\"~:e\",0.0,\"~:f\",0.0]],\"~:rotation\",0,\"~:layout-wrap-type\",\"~:nowrap\",\"~:layout\",\"~:flex\",\"~:hide-in-viewer\",true,\"~:name\",\"Board\",\"~:layout-align-items\",\"~:start\",\"~:width\",132.99999487400055,\"~:layout-padding-type\",\"~:simple\",\"~:type\",\"~:frame\",\"~:points\",[[\"~#point\",[\"^ \",\"~:x\",850.9999846220016,\"~:y\",512.9999568462372]],[\"^J\",[\"^ \",\"~:x\",983.9999794960022,\"~:y\",512.9999568462372]],[\"^J\",[\"^ \",\"~:x\",983.9999794960022,\"~:y\",549.9999556541443]],[\"^J\",[\"^ \",\"~:x\",850.9999846220016,\"~:y\",549.9999556541443]]],\"~:r2\",0,\"~:show-content\",true,\"~:layout-item-h-sizing\",\"~:auto\",\"~:proportion-lock\",false,\"~:layout-gap\",[\"^ \",\"~:row-gap\",0,\"~:column-gap\",0],\"~:transform-inverse\",[\"^:\",[\"^ \",\"~:a\",1.0,\"~:b\",0.0,\"~:c\",0.0,\"~:d\",1.0,\"~:e\",0.0,\"~:f\",0.0]],\"~:layout-item-v-sizing\",\"^N\",\"~:r3\",0,\"~:layout-justify-content\",\"^C\",\"~:r1\",0,\"~:id\",\"~ub98e38af-59e9-8056-8007-c3577ef85c83\",\"~:parent-id\",\"~u00000000-0000-0000-0000-000000000000\",\"~:layout-flex-dir\",\"~:row\",\"~:layout-align-content\",\"~:stretch\",\"~:frame-id\",\"~u00000000-0000-0000-0000-000000000000\",\"~:strokes\",[],\"~:x\",850.9999846220016,\"~:proportion\",1,\"~:r4\",0,\"~:selrect\",[\"~#rect\",[\"^ \",\"~:x\",850.9999846220016,\"~:y\",512.9999568462372,\"^D\",132.99999487400055,\"~:height\",36.999998807907104,\"~:x1\",850.9999846220016,\"~:y1\",512.9999568462372,\"~:x2\",983.9999794960022,\"~:y2\",549.9999556541443]],\"~:fills\",[[\"^ \",\"~:fill-color\",\"#ffffff\",\"~:fill-opacity\",1]],\"~:flip-x\",null,\"^18\",36.999998807907104,\"~:flip-y\",null,\"~:shapes\",[\"~ub98e38af-59e9-8056-8007-c35778509984\"]]]"
}
},
"~:id": "~u7fd33337-c651-80ae-8007-c357213f876f",
"~:name": "Page 1"
}
}

View File

@@ -0,0 +1,135 @@
{
"~:features": {
"~#set": [
"fdata/path-data",
"plugins/runtime",
"design-tokens/v1",
"variants/v1",
"layout/grid",
"styles/v2",
"fdata/pointer-map",
"fdata/objects-map",
"render-wasm/v1",
"components/v2",
"fdata/shape-data-type"
]
},
"~:team-id": "~ud715d0a5-a44e-8056-8005-a79999e18b64",
"~:permissions": {
"~:type": "~:membership",
"~:is-owner": true,
"~:is-admin": true,
"~:can-edit": true,
"~:can-read": true,
"~:is-logged": true
},
"~:has-media-trimmed": false,
"~:comment-thread-seqn": 0,
"~:name": "New File 10",
"~:revn": 2,
"~:modified-at": "~m1774363460059",
"~:vern": 0,
"~:id": "~u7fd33337-c651-80ae-8007-c357213f876e",
"~:is-shared": false,
"~:migrations": {
"~#ordered-set": [
"legacy-2",
"legacy-3",
"legacy-5",
"legacy-6",
"legacy-7",
"legacy-8",
"legacy-9",
"legacy-10",
"legacy-11",
"legacy-12",
"legacy-13",
"legacy-14",
"legacy-16",
"legacy-17",
"legacy-18",
"legacy-19",
"legacy-25",
"legacy-26",
"legacy-27",
"legacy-28",
"legacy-29",
"legacy-31",
"legacy-32",
"legacy-33",
"legacy-34",
"legacy-36",
"legacy-37",
"legacy-38",
"legacy-39",
"legacy-40",
"legacy-41",
"legacy-42",
"legacy-43",
"legacy-44",
"legacy-45",
"legacy-46",
"legacy-47",
"legacy-48",
"legacy-49",
"legacy-50",
"legacy-51",
"legacy-52",
"legacy-53",
"legacy-54",
"legacy-55",
"legacy-56",
"legacy-57",
"legacy-59",
"legacy-62",
"legacy-65",
"legacy-66",
"legacy-67",
"0001-remove-tokens-from-groups",
"0002-normalize-bool-content-v2",
"0002-clean-shape-interactions",
"0003-fix-root-shape",
"0003-convert-path-content-v2",
"0005-deprecate-image-type",
"0006-fix-old-texts-fills",
"0008-fix-library-colors-v4",
"0009-clean-library-colors",
"0009-add-partial-text-touched-flags",
"0010-fix-swap-slots-pointing-non-existent-shapes",
"0011-fix-invalid-text-touched-flags",
"0012-fix-position-data",
"0013-fix-component-path",
"0013-clear-invalid-strokes-and-fills",
"0014-fix-tokens-lib-duplicate-ids",
"0014-clear-components-nil-objects",
"0015-fix-text-attrs-blank-strings",
"0015-clean-shadow-color",
"0016-copy-fills-from-position-data-to-text-node",
"0017-fix-layout-flex-dir"
]
},
"~:version": 67,
"~:project-id": "~u76eab896-accf-81a5-8007-2b264ebe7817",
"~:created-at": "~m1774363353342",
"~:backend": "legacy-db",
"~:data": {
"~:pages": [
"~u7fd33337-c651-80ae-8007-c357213f876f"
],
"~:pages-index": {
"~u7fd33337-c651-80ae-8007-c357213f876f": {
"~#penpot/pointer": [
"~u7fd33337-c651-80ae-8007-c3578977e5be",
{
"~:created-at": "~m1774363460064"
}
]
}
},
"~:id": "~u7fd33337-c651-80ae-8007-c357213f876e",
"~:options": {
"~:components-v2": true,
"~:base-font-size": "16px"
}
}
}

View File

@@ -112,3 +112,30 @@ test("BUG 13272 - Fix problem with snap to pixel", async ({ page }) => {
await expect(workspacePage.rightSidebar.getByTitle("Width").getByRole("textbox")).toHaveValue("197.5");
await expect(workspacePage.rightSidebar.getByTitle("Height").getByRole("textbox")).toHaveValue("128.28");
});
test("BUG 13755 - Fix problem with text change modiifers", async ({ page }) => {
const workspacePage = new WasmWorkspacePage(page);
await workspacePage.setupEmptyFile();
await workspacePage.mockGetFile("workspace/get-file-13755.json");
await workspacePage.mockRPC(
"get-file-fragment?file-id=*&fragment-id=*",
"workspace/get-file-13755-fragment.json",
);
await workspacePage.mockRPC("update-file?id=*", "workspace/update-file-empty.json");
await workspacePage.goToWorkspace({
fileId: "7fd33337-c651-80ae-8007-c357213f876e",
pageId: "7fd33337-c651-80ae-8007-c357213f876f",
});
await workspacePage.clickToggableLayer("Board");
await workspacePage.clickLeafLayer("uno dos tres cuatro");
await workspacePage.page.keyboard.press('Enter');
await workspacePage.page.keyboard.type('test');
await workspacePage.clickToggableLayer("Board");
await expect(workspacePage.rightSidebar.getByTitle("Width").getByRole("textbox")).toHaveValue("23");
});

View File

@@ -1026,10 +1026,15 @@
:stack-undo? effective-stack-undo?
:undo-group (when new-shape? id)})
;; When we don't update the shape (no new-size), still update WASM display
(when-not (some? new-size)
;; When `get-wasm-text-new-size` reports a change, `update-shapes` above resizes the
;; shape data; the WASM renderer still needs matching modifiers. While editing, use
;; `set-wasm-modifiers` for a temporary preview; on `finalize?`, `apply-wasm-modifiers`
;; commits layout (flex parents, sidebar width, etc.) like other transform flows.
(when (some? new-size)
(when-let [modifiers (dwwt/resize-wasm-text-modifiers shape content)]
(dwm/set-wasm-modifiers modifiers {:undo-group (when new-shape? id)}))))
(if finalize?
(dwm/apply-wasm-modifiers modifiers {:undo-group (when new-shape? id)})
(dwm/set-wasm-modifiers modifiers {:undo-group (when new-shape? id)})))))
(when finalize?
(rx/concat