Skip to content

Update Blocks Everywhere for current Gutenberg - #211

Draft
chubes4 wants to merge 120 commits into
trunkfrom
update/from-extra-chill-modernization
Draft

Update Blocks Everywhere for current Gutenberg#211
chubes4 wants to merge 120 commits into
trunkfrom
update/from-extra-chill-modernization

Conversation

@chubes4

@chubes4 chubes4 commented May 26, 2026

Copy link
Copy Markdown

Why

WordPress.org support forums are pinned to Gutenberg 17.9 because the upstream Blocks Everywhere plugin is outdated. Automattic trunk was still at Blocks Everywhere 1.23.0, used @automattic/isolated-block-editor, and could not move cleanly to the latest Gutenberg package set needed for current WordPress work.

This PR updates upstream Blocks Everywhere from 1.23.0 to 3.2.5 and brings over the maintained implementation that runs on current WordPress/Gutenberg editor packages without depending on isolated-block-editor.

What Changes Versus Automattic Trunk

  • Removes the @automattic/isolated-block-editor dependency and replaces it with direct Gutenberg package usage, including @wordpress/block-editor, @wordpress/editor, @wordpress/components, @wordpress/data, @wordpress/core-data, and related packages.
  • Replaces the old handler subclass model with a generic context engine plus context config files under classes/contexts/.
  • Reworks the embedded editor bootstrap from an IBE wrapper to a native embedded Gutenberg shell using BlockEditorProvider, BlockCanvas, editor toolbar primitives, and slot/fill wiring.
  • Adds reusable editor shell components, content bridge behavior, slot fills, post entity wiring, detached sidebar support, host entity bridges, lifecycle events, service injection, mode-aware settings, and initial content transform orchestration.
  • Adds native Gutenberg pattern settings support for frontend editors, including adapter-provided patterns/categories, allow/deny pattern filters, empty-editor pattern seeding docs, and synced-pattern/override boundary docs.
  • Adds portable editor hardening so public lifecycle events are sanitized, REST bootstrap behavior is per-instance where BE owns requests, allowed blocks stay instance-scoped, MediaUpload global hook installation is explicit, and page-global Gutenberg bootstrap boundaries are documented.
  • Updates bbPress behavior for modern support-forum usage, including draft restore/autosave handling, reply draft context switching, configured draft/media endpoints, gated media uploads, KSES recursion coverage, and opt-in attachment reparenting.
  • Updates styling for the native embedded Gutenberg shell, iframe canvas behavior, toolbar layout, block inserter/list-view surfaces, dark-mode/theme-token compatibility, and theme compatibility CSS.
  • Updates support-content embed block code and docs for the current architecture.
  • Updates plugin metadata from 1.23.0 to 3.2.5, raises PHP requirement to 7.4, and updates package/tooling versions.
  • Incorporates the dependency audit resolution from Automattic trunk so this branch is current with the latest base branch.

Why This Shape

This is intentionally a large modernization PR rather than a narrow patch. The blocker is the old editor integration layer itself: keeping upstream BE tied to isolated-block-editor keeps WordPress.org support forums pinned to an old Gutenberg version. The maintained implementation removes that dependency and gives BE a current, generic editor integration surface that can keep moving with Gutenberg.

The new portable editor contracts are intentionally generic: adapters own host routing, permissions, persistence, entity identity, and product-specific UI; Blocks Everywhere owns Gutenberg runtime composition, serialization, lifecycle, services, and extension points.

Verification

  • yarn wp-scripts lint-js src/index.tsx src/bootstrap-settings.ts src/editor/index.tsx src/editor/bbpress-adapter.ts src/editor/editor-services.ts src/block-customization/embed.tsx src/block-customization/paragraph/index.tsx src/block-customization/paragraph/edit.tsx
  • yarn wp-scripts lint-js src/editor/index.tsx
  • composer install && composer run-script test passes with existing PHP 8.4 vendor deprecation noise: 23 tests, 84 assertions.
  • yarn build
  • git diff --check origin/trunk...HEAD
  • Confirmed CLAUDE.md, homeboy.json, and docs/CHANGELOG.md are not included in the Automattic PR diff.

Known Follow-ups

  • Full repository lint suites may still report broader historical docs/style issues outside the targeted modernization checks.
  • Gutenberg unstable API usage remains tracked separately; BE uses the best available public/experimental primitives and documents those boundaries.

AI assistance

  • AI assistance: Yes
  • Tool(s): OpenCode (gpt-5.5)
  • Used for: Auditing the maintained branch for upstream-specific cleanup, coordinating cleanup PR review/merge order, porting the cleaned branch upstream, resolving the latest trunk dependency conflict, and drafting/updating this PR description. Chris remains responsible for review and testing.

chubes4 and others added 30 commits December 13, 2025 13:32
… support

- Add WordPress 6.9 and PHP 8.4 compatibility
- Add comprehensive dark mode and theme variable support for editor UI
- Add custom media upload API integration for bbPress
- Add automatic attachment reparenting for new bbPress topics
- Fix iframe editor styles for responsive embeds
- Fix block category retrieval using WP_Block_Editor_Context
- Improve script loading order reliability
- Update to forked isolated-block-editor dependency
- Move legacy changelog to docs/CHANGELOG.md per WP.org recommendations
- Add AGENTS.md for development standards
…ents

- Fixed SASS import syntax for modern SASS compatibility
- Enhanced TypeScript definitions with optional properties
- Updated webpack configuration with isolated-block-editor alias
- Add browser globals to ESLint config (wpBlocksEverywhere, wp, jQuery, etc.)
- Add missing dependencies: classnames, @wordpress/icons
- Enhance TypeScript type definitions in types.d.ts
- Fix JSDoc documentation for functions
- Fix accessibility issues in search results (key prop, keyboard handlers)
- Fix strict equality operators (=== vs ==)
- Configure ESLint overrides for TypeScript files
- Auto-fix 127 formatting issues with Prettier

Reduces ESLint errors from 275 to 0 (4 warnings remain)
…afety

- Fixed 275 ESLint errors through configuration improvements
- Enhanced TypeScript type definitions with unknown instead of any
- Added missing dependencies (classnames, @wordpress/icons)
- Improved JSDoc documentation for better code clarity
- Fixed accessibility issues in search results components
- Fixed strict equality operators throughout codebase
- Fix toolbar button active state styling with theme-mapped CSS variables
- Fix toolbar button pressed state ::before pseudo-element background
- Fix list block rendering in iframe editor (bullets and indentation)
Move WordPress-specific theme supports dispatch from isolated-block-editor
to blocks-everywhere, keeping isolated-block-editor WordPress-agnostic.
New handler that exposes load_editor() for any plugin to mount a block
editor on the frontend without coupling to bbPress, BuddyPress, or
comments. Used by extrachill-studio for the Compose tab blog editor.
Removed inserter button accent-3 branding, placeholder card styling,
and footer spacing tokens from editor.scss and $iframe_editor_css.
These are consumer-specific (Extra Chill brand) and now live in
@extrachill/tokens/css/block-editor.css. Blocks Everywhere stays
generic — it handles Gutenberg variable mappings and structural
theming; consumers add their own brand layer on top.
)

* refactor: replace handler subclasses with data-driven context engine

Replace the per-handler class pattern (bbPress, BuddyPress, Comments, Frontend)
with a single Engine class that processes context configuration arrays identically.
External plugins register contexts via the blocks_everywhere_contexts filter.

- Add Engine class that manages context registration, trigger wiring, and editor loading
- Extract bbPress-specific callbacks to standalone functions in contexts/bbpress-callbacks.php
- Move handler configs to context arrays in contexts/{bbpress,buddypress,comments}.php
- Delete all handler subclasses (class-bbpress, class-buddypress, class-comments, class-frontend)
- Preserve all backward-compatible filters (blocks_everywhere_bbpress, _comments, _buddypress, etc.)
- Update tests to use standalone functions instead of handler class methods
- Update CLAUDE.md to reflect new architecture

* simplify: lean Engine with editor_setup callbacks, remove config bloat

Engine reduced from 392 to 243 lines. Config shape shrunk from 22 keys to 7.
Domain-specific setup (KSES, save filters, body class, filter removal) moves
into editor_setup callbacks owned by each context — the Engine doesn't need
to know about bbPress encode_bad or comment KSES contexts.

Content display filters, metadata, and email hooks wire directly in context
functions instead of going through Engine indirection.

* chore: register blocks-everywhere as homeboy component
Handler\bbPress, Handler\BuddyPress, Handler\Comments, Handler\Frontend
classes are deleted. Consumers must migrate to blocks_everywhere_contexts
filter API. All filter hooks are backward-compatible.
Homeboy release auto-bumped to 1.26.0 instead of 2.0.0 because --major
is a permission flag, not a directive. The changelog was generated under
the wrong version. This corrects it and removes the phantom 1.26.0 entry.
The Handler base class was calling wp_register_script/wp_register_style
in its constructor, which fires at plugin load time before the
wp_enqueue_scripts hook. WordPress 6.x logs notices about this.

Move registration to an init callback at priority 5 (before the Engine
boots at default priority) so assets are registered at the proper time.
WordPress considers init too early for wp_register_script. wp_loaded
fires after all plugins are loaded but before page rendering, so assets
are registered at the right time.
Add ContentBridge — a React component that renders inside the IBE tree
(accessing the sub-registry) and attaches a content API to the textarea
element. External code can read/replace editor content without needing
direct access to the isolated/editor store.

API surface (per textarea):
- replaceContent(html) — parse HTML and dispatch replaceContent to store
- getContent() — serialize current blocks to HTML
- getBlocks() — get raw block objects

Global lookup:
- window.blocksEverywhereGetContentApi(textarea) — returns the API or null

This bridges the sub-registry isolation gap so consumers like Studio and
Community can hot-swap editor content without destroying and recreating
the editor instance.
Replace the editorKey remount pattern in maybeInstallReplyDraftContextHandler
with the ContentBridge replaceContent API. The editor stays mounted when
switching between reply targets — content is hot-swapped via the IBE
store's replaceContent action which resets blocks and undo history.

This is the same API that Studio's compose tab now uses for draft switching.
@chubes4
chubes4 marked this pull request as ready for review May 31, 2026 03:10
@chubes4
chubes4 marked this pull request as draft May 31, 2026 14:26
Clorith added a commit to Clorith/wordpress.org that referenced this pull request Jun 9, 2026
This introduces the support forums as an environment in the WordPress.org suite of sites. Complete with full dependency setup, including:

- Multisite setup
- Plugin and theme directory subsites (scaffolds for plugin and theme support forums, not for their development)
- Full set of every usertype available
- Default forum creation, mimicking the current WordPress.org forums

There is a caveat that Gutenberg is _currently_ pinned to version 17.9, due to the Blocks Everywhere plugin, and that Blocks Everywhere is not rendering properly pending an update in Automattic/blocks-everywhere#211
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