DataViews: Move the rich text control into the editor package - #81430
Conversation
…ckage
`@wordpress/dataviews` is a bundled package that plugins install from npm,
and its rich text control unlocked `@wordpress/rich-text` private APIs at
module scope. The registry and the package's `privateApis` export both
pulled it in, so any `import { DataForm }` evaluated the unlock before
anything rendered: plugins importing `@wordpress/dataviews` crashed against
the copy WordPress ships, and `@wordpress/dataviews/wp` shipped a second
copy of `@wordpress/rich-text` that reused core's `core/rich-text` store, so
core's formats read the wrong React contexts and blanked the app.
Move the control to `@wordpress/editor`, next to the note form that is its
only consumer. There `@wordpress/rich-text` resolves to the same `wp.richText`
the block editor uses, so the format registry, its store, and its contexts
are shared. Same component, no behavior change.
Removes the built-in `richtext` DataForm control, its `EditConfigRichText`
type, and DataViews' `privateApis` export, whose only member this was.
`@wordpress/rich-text` is no longer a DataViews dependency.
Fixes #81233.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
|
Size Change: -5.2 kB (-0.07%) Total Size: 7.65 MB 📦 View Changed
|
The CHANGELOG check requires each entry to link to its own PR. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Mamaduka
left a comment
There was a problem hiding this comment.
Thanks, Riad!
Everything seems to works as before, and we have good e2e test coverage for the RichText notes feature.
|
Thanks, this works for me. We may want to offer |
Co-authored-by: youknowriad <youknowriad@git.wordpress.org> Co-authored-by: Mamaduka <mamaduka@git.wordpress.org> Co-authored-by: oandregal <oandregal@git.wordpress.org>
|
This PR seems important to backport to 7.1, so I've prepared #82186 |
|
Why should this be back ported to 7.1 branch? |
|
Actually, no need. DataViews isn't available through the global so nobody will have access to this change. |
What?
Closes #81233.
Moves the rich text control out of
@wordpress/dataviewsand into@wordpress/editor, next to the note form that is its only consumer. Removes the built-inrichtextDataForm control (breaking) and DataViews' dependency on@wordpress/rich-text.Why?
DataViews is a bundled package installed from npm, and the control unlocked
@wordpress/rich-textat module scope — reachable from anyimport { DataForm }, via both the control registry and theprivateApisexport. Plugins importing@wordpress/dataviewscrashed against the copy WordPress ships; the/wpbuild carried a second copy that reused core'score/rich-textstore, so core's formats read the wrong React contexts and blanked the app. WooCommerce pinned 17.1.0, Jetpack patched around it.Those were the only files importing rich-text, so moving them drops the dependency and both failure modes — lazy loading would only have covered the first. In
@wordpress/editor,@wordpress/rich-textis the samewp.richTextthe block editor uses: one registry, one store, one set of contexts.How?
The control,
FormatEdit,getAllowedFormats, its tests and its placeholder styles move verbatim — only the wrapper class name and import paths changed. Gone from DataViews: therichtextregistry entry,EditConfigRichText, theprivateApisexport (this control was its only member),@wordpress/rich-text, and the story field. The/wpbuild drops 122KB and every rich-text code path with it.Two things to flag:
Edit: 'richtext'was public API in 17.2, so DataViews needs a major bump. It only ever worked inside Gutenberg's own build.Edit, and there's no public way to assemble one outside@wordpress/block-editor. That's therich-textitem in DataViews: remove all private API usage #81230 — this closes 6 of the others.Testing Instructions
`code`transforms,@opens mentions, Shift+Enter makes exactly one new line, ⌘Enter submits.npm run test:e2e -- --project=chromium ../specs/editor/various/block-notes.spec.jspasses 48/48, as do the unit tests for both packages.Testing Instructions for Keyboard
Same as above — the whole flow is keyboard-driven.
Use of AI Tools
Authored with Claude Code (Opus 5): the move, the DataViews removals, the test runs, and this description.