Skip to content

Add data-style attributes for resolved style fields#146

Merged
sneridagh merged 3 commits into
mainfrom
addData-StyleAttrs
Jun 23, 2026
Merged

Add data-style attributes for resolved style fields#146
sneridagh merged 3 commits into
mainfrom
addData-StyleAttrs

Conversation

@sneridagh

Copy link
Copy Markdown
Member

Summary

  • preserve resolved style field values in @plone/helpers even when the selected definition has no style object
  • expose resolved style field values from @plone/plate as data-style-* attributes on editor element props
  • add towncrier news entries for both affected release targets

Changes

  • packages/helpers/src/styleFields.ts now records the effective semantic value before checking whether the matching definition contributes CSS, so consumers can still access the resolved value when a style field is value-only
  • packages/helpers/src/styleFields.test.ts adds coverage for definitions without a style object to lock in the returned { values, style } contract
  • packages/plate/components/editor/plugins/style-fields-plugin.ts now converts resolved style-field values into data-style-* element props and keeps merging CSS styles when present
  • packages/plate/components/editor/plugins/block-width-plugin.test.ts adds assertions for the new data-style-blockWidth and data-style-theme attributes so the Plate output contract is explicit
  • packages/helpers/news/+style-field-values.bugfix documents the helpers fix
  • packages/plate/news/+style-field-data-attrs.feature documents the new Plate capability

Testing

  • pnpm --filter @plone/helpers test --run src/styleFields.test.ts
  • pnpm --filter @plone/plate test --run components/editor/plugins/block-width-plugin.test.ts
  • pnpm --filter @plone/plate check:ts

@sneridagh sneridagh merged commit cf00733 into main Jun 23, 2026
30 checks passed
@sneridagh sneridagh deleted the addData-StyleAttrs branch June 23, 2026 19:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant