Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Editor: Shim meta attributes for early block registrations #20544

Merged
merged 3 commits into from
Feb 28, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Editor: Clarify comment regarding meta attribute shim
  • Loading branch information
aduth committed Feb 28, 2020
commit 6ca77f4a506accadb8e6f1822c562fef176be124
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@ addFilter(
);

// The above filter will only capture blocks registered after the filter was
// applied. There may already be registered by this point, and those must be
// updated to apply the shim.
// added. There may already be blocks registered by this point, and those must
// be updated to apply the shim.
//
// The following implementation achieves this, albeit with a couple caveats:
// - Only blocks registered on the global store will be modified.
Expand All @@ -128,6 +128,13 @@ addFilter(
// `getBlockType` separate from `getBlockTypes`, since the latter returns a
// _copy_ of the block registration (i.e. the mutation would not affect the
// actual registered block settings).
//
// `getBlockTypes` or `getBlockType` implementation could change in the future
// in regards to creating settings clones, but the corresponding end-to-end
// tests for meta blocks should cover against any potential regressions.
//
// In the future, we could support updating block settings, at which point this
// implementation could use that mechanism instead.
globalSelect( 'core/blocks' )
.getBlockTypes()
.map( ( { name } ) => globalSelect( 'core/blocks' ).getBlockType( name ) )
aduth marked this conversation as resolved.
Show resolved Hide resolved
Expand Down