Skip to content

Add editor plugin mounts to v2 shell - #79222

Closed
scruffian wants to merge 1 commit into
trunkfrom
scruffian/v2-site-editor-diff
Closed

scruffian wants to merge 1 commit into
trunkfrom
scruffian/v2-site-editor-diff

Conversation

@scruffian

@scruffian scruffian commented Jun 16, 2026 •

Copy link
Copy Markdown
Contributor

What?

Adds PluginArea mounting to the v2 boot shell so registered plugin UI can render in both full app and single-page modes, mounts the editor Preferences modal in the v2 lazy editor path, and loads v2 lazy-editor settings/assets with a Site Editor context.

Why?

The v2 Site Editor shell already provides SlotFillProvider, but it did not mount PluginArea, so registerPlugin() render callbacks had no shell-level mount point outside the editor canvas. The lazy editor path also opened editor/preferences from the editor more menu without rendering the corresponding modal shell.

The lazy editor settings/assets requests also used the generic post editor context. That meant plugins enabled for the Site Editor could be missed when they enqueue assets or filter settings based on core/edit-site, the site-editor screen, the old site-editor.php admin hook, or global $pagenow.

How?

This adds a boot-local PluginArea wrapper with the same error-notice behavior used by the v1 Site Editor, mounts it in both boot roots, declares the @wordpress/plugins dependency and TypeScript reference, and renders PreferencesModal from the private editor APIs inside the lazy editor.

The boot canvas now renders lazy editor with context="site-editor". For that context, lazy editor requests /wp-block-editor/v1/settings and /wp-block-editor/v1/assets with context=site-editor, and the REST controller maps that to core/edit-site, the site-editor screen, site-editor.php hook suffix, and $pagenow during asset collection.

Testing Instructions

  1. Run npm run lint:js -- packages/lazy-editor/src/hooks/use-editor-assets.tsx packages/lazy-editor/src/hooks/use-editor-settings.tsx packages/lazy-editor/src/components/editor/index.tsx packages/boot/src/components/canvas/index.tsx packages/boot/src/components/plugin-area/index.tsx packages/boot/src/components/root/index.tsx packages/boot/src/components/root/single-page.tsx.
  2. Run ./node_modules/.bin/tsc -p packages/lazy-editor/tsconfig.json --noEmit --pretty false && ./node_modules/.bin/tsc -p packages/boot/tsconfig.json --noEmit --pretty false.
  3. Run php -l lib/experimental/class-wp-rest-block-editor-settings-controller.php.
  4. With the extensible Site Editor enabled, enable Create Block Theme or another plugin that registers editor SlotFill UI and enqueues for the Site Editor, then confirm its UI renders in the v2 editor.
  5. Open the editor more menu in the v2 editor, choose Preferences, and confirm the Preferences modal opens.

Testing Instructions for Keyboard

When testing a registered plugin UI in the v2 shell, use the keyboard to tab to any plugin-provided controls and confirm they can be focused and operated.

Screenshots or screencast

N/A

Use of AI Tools

This PR was prepared with AI assistance from Codex. The resulting code and checks were reviewed before submission.

@scruffian
scruffian marked this pull request as ready for review June 16, 2026 09:33
@scruffian
scruffian marked this pull request as draft June 16, 2026 09:33
@github-actions

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: scruffian <scruffian@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

Copy link
Copy Markdown

Warning: Type of PR label mismatch

To merge this PR, it requires exactly 1 label indicating the type of PR. Other labels are optional and not being checked here.

  • Required label: Any label starting with [Type].
  • Labels found: .

Read more about Type labels in Gutenberg. Don't worry if you don't have the required permissions to add labels; the PR reviewer should be able to help with the task.

@scruffian scruffian changed the title [codex] Add PluginArea to boot roots Add PluginArea to v2 Site Editor Jun 16, 2026
@scruffian
scruffian force-pushed the scruffian/v2-site-editor-diff branch from 3b424bb to 9af01bd Compare June 16, 2026 09:37
@scruffian scruffian changed the title Add PluginArea to v2 Site Editor Add editor plugin mounts to v2 shell Jun 16, 2026
@github-actions

github-actions Bot commented Jun 16, 2026 •

Copy link
Copy Markdown

Size Change: +440 B (+0.01%)

Total Size: 8.6 MB

📦 View Changed
Filename Size Change
build/modules/boot/index.min.js 53 kB +161 B (+0.3%)
build/modules/lazy-editor/index.min.js 14.5 kB +279 B (+1.96%)

compressed-size-action

@scruffian
scruffian force-pushed the scruffian/v2-site-editor-diff branch from 9af01bd to 932e351 Compare June 16, 2026 14:12
@github-actions

github-actions Bot commented Jun 16, 2026 •

Copy link
Copy Markdown

Flaky tests detected in c5a8daa.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/27680650741
📝 Reported issues:

@scruffian
scruffian force-pushed the scruffian/v2-site-editor-diff branch 3 times, most recently from db95375 to e741ce1 Compare June 17, 2026 09:39
@scruffian
scruffian force-pushed the scruffian/v2-site-editor-diff branch from e741ce1 to c5a8daa Compare June 17, 2026 09:53
@scruffian scruffian mentioned this pull request Jul 6, 2026
4 of 14 tasks
@youknowriad

Copy link
Copy Markdown
Contributor

I've been looking at this:

  • the PreferencesModal is fixed.
  • I'm not sure about the changes related to the editor settings and $pagenow, I think these changes break what the boot package is about and its architecture. The lazy-editor already tries to load the third-party scripts that target the editor (obviously some things may still be missed). But I'd prefer not to do anything here and assess issues first. We should not assume that boot corresponds to the site editor like before.

So I'm opening a small PR out of this just for the PluginArea changes.

youknowriad added a commit that referenced this pull request Aug 20, 2026
Nothing rendered a PluginArea, so every plugin registered with
registerPlugin was inert: its sidebars, document panels and menu items
had no mount point and never reached their slots.

Mount one in both roots, inside the SlotFillProvider the fills need, and
surface a plugin that throws as a notice naming it rather than losing the
screen.

At the root rather than with the editor. A plugin's fills mostly target
editor slots, but the component holding them is also where it registers
commands and extends a list, and the routes without a canvas need that
too.

Extracted from #79222, which also carried the preferences modal since
landed in #81630, and a REST context change that deserves its own review.

Co-Authored-By: Ben Dwyer <ben@scruffian.com>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@youknowriad

Copy link
Copy Markdown
Contributor

Closing this one as I landed a simpler alternative for now.

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.

2 participants