Skip to content

DataViews: Move the rich text control into the editor package - #81430

Merged
youknowriad merged 2 commits into
trunkfrom
claude/move-richtext-control-to-editor
Aug 11, 2026
Merged

DataViews: Move the rich text control into the editor package#81430
youknowriad merged 2 commits into
trunkfrom
claude/move-richtext-control-to-editor

Conversation

@youknowriad

@youknowriad youknowriad commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

What?

Closes #81233.

Moves the rich text control out of @wordpress/dataviews and into @wordpress/editor, next to the note form that is its only consumer. Removes the built-in richtext DataForm control (breaking) and DataViews' dependency on @wordpress/rich-text.

Why?

DataViews is a bundled package installed from npm, and the control unlocked @wordpress/rich-text at module scope — reachable from any import { DataForm }, via both the control registry and the privateApis export. Plugins importing @wordpress/dataviews crashed against the copy WordPress ships; the /wp build carried a second copy that reused core's core/rich-text store, 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-text is the same wp.richText the 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: the richtext registry entry, EditConfigRichText, the privateApis export (this control was its only member), @wordpress/rich-text, and the story field. The /wp build drops 122KB and every rich-text code path with it.

Two things to flag:

Testing Instructions

  1. Open a post and add a note from the block options menu.
  2. In the note field: ⌘B / ⌘I format, ⌘K opens the link popover and the field stays selected, `code` transforms, @ opens mentions, Shift+Enter makes exactly one new line, ⌘Enter submits.
  3. Add a note, reply to it, edit it — formatting round-trips.

npm run test:e2e -- --project=chromium ../specs/editor/various/block-notes.spec.js passes 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.

…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>
@github-actions

github-actions Bot commented Aug 11, 2026

Copy link
Copy Markdown

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 props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: youknowriad <youknowriad@git.wordpress.org>
Co-authored-by: Mamaduka <mamaduka@git.wordpress.org>
Co-authored-by: oandregal <oandregal@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@github-actions github-actions Bot added [Package] Editor /packages/editor [Package] DataViews /packages/dataviews labels Aug 11, 2026
@Mamaduka Mamaduka added the [Type] Bug An existing feature does not function as intended label Aug 11, 2026
@github-actions

Copy link
Copy Markdown

Size Change: -5.2 kB (-0.07%)

Total Size: 7.65 MB

📦 View Changed
Filename Size Change
build/scripts/block-editor/index.min.js 434 kB -1.48 kB (-0.34%)
build/scripts/edit-site/index.min.js 311 kB -1.46 kB (-0.47%)
build/scripts/editor/index.min.js 510 kB -512 B (-0.1%)
build/scripts/media-utils/index.min.js 129 kB -1.55 kB (-1.18%)
build/styles/edit-site/style-rtl.css 21.6 kB -42 B (-0.19%)
build/styles/edit-site/style-rtl.min.css 17.7 kB -46 B (-0.26%)
build/styles/edit-site/style.css 21.6 kB -43 B (-0.2%)
build/styles/edit-site/style.min.css 17.7 kB -46 B (-0.26%)
build/styles/editor/style-rtl.min.css 27 kB -7 B (-0.03%)
build/styles/editor/style.min.css 27 kB -7 B (-0.03%)

compressed-size-action

The CHANGELOG check requires each entry to link to its own PR.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@youknowriad
youknowriad requested a review from Mamaduka August 11, 2026 11:48

@Mamaduka Mamaduka left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, Riad!

Everything seems to works as before, and we have good e2e test coverage for the RichText notes feature.

@oandregal

Copy link
Copy Markdown
Member

Thanks, this works for me.

We may want to offer richtext as a control like we offer textarea and others, but not by exporting it as private API.

@youknowriad
youknowriad merged commit a91983c into trunk Aug 11, 2026
62 checks passed
@youknowriad
youknowriad deleted the claude/move-richtext-control-to-editor branch August 11, 2026 15:47
@github-actions github-actions Bot added this to the Gutenberg 23.8 milestone Aug 11, 2026
shail-mehta pushed a commit that referenced this pull request Aug 12, 2026
Co-authored-by: youknowriad <youknowriad@git.wordpress.org>
Co-authored-by: Mamaduka <mamaduka@git.wordpress.org>
Co-authored-by: oandregal <oandregal@git.wordpress.org>
@oandregal

Copy link
Copy Markdown
Member

This PR seems important to backport to 7.1, so I've prepared #82186

@youknowriad

Copy link
Copy Markdown
Contributor Author

Why should this be back ported to 7.1 branch?

@oandregal

Copy link
Copy Markdown
Member

Actually, no need. DataViews isn't available through the global so nobody will have access to this change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Package] DataViews /packages/dataviews [Package] Editor /packages/editor [Type] Bug An existing feature does not function as intended

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DataViews: the rich text control breaks plugins that bundle DataViews

3 participants