Use Custom HTML block for freeform content behind an experiment#79498
Draft
tyxla wants to merge 1 commit into
Draft
Use Custom HTML block for freeform content behind an experiment#79498tyxla wants to merge 1 commit into
tyxla wants to merge 1 commit into
Conversation
Adds a Gutenberg experiment that switches the freeform content handler (used for non-block content) from the Classic block (core/freeform) to the Custom HTML block (core/html). - Gate the freeform handler in registerCoreBlocks on a new window.__experimentalEnableHtmlFreeformHandler global. - Bridge the experiment toggle to that global in editor-settings.php. - Register the 'gutenberg-html-freeform-handler' experiment on the Experiments screen.
37 tasks
|
Size Change: +26 B (0%) Total Size: 7.51 MB 📦 View Changed
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What?
Adds a Gutenberg experiment that switches the freeform content handler — the block used to hold non-block (freeform) content that has no block delimiters — from the Classic block (
core/freeform) to the Custom HTML block (core/html).Why?
Exploring whether
core/htmlis a better default home for freeform content than the Classic block (core/freeform). Wrapping it as an opt-in experiment so the behavior change is gated and easy to evaluate.Part of #78067.
How?
packages/block-library/src/index.js— InregisterCoreBlocks, the freeform content handler now checks a newwindow.__experimentalEnableHtmlFreeformHandlerglobal first; when set, it callssetFreeformContentHandlerName( html.name )instead of the Classic-block path.lib/experimental/editor-settings.php— Bridges the experiment toggle to that JS global (same pattern as the existing form/block experiments).lib/experimental/experiments/load.php— Registers thegutenberg-html-freeform-handlerexperiment in the Blocks group on the Experiments screen.This reuses a known-good combination: the widgets editors (
edit-widgets,customize-widgets) already usesetFreeformContentHandlerName( 'core/html' ), andcore/htmlis always registered, so no extra guard is needed.Testing Instructions
npm run buildornpm start).Notes
core/htmlunconditionally — including whenwp.oldEditoris present — so the Classic-block fallback is disabled while the experiment is on.