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

Block Editor: Enable entity-synced inner blocks. #18739

Closed
wants to merge 3 commits into from

Conversation

epiqueras
Copy link
Contributor

Description

This PR has changes that will be required by any block that needs to sync its serialized inner blocks to one of its entity properties.

E.g. Post Content.

The changes are as follows:

  • Add a controlled props (value/change handlers) mode to InnerBlocks so that we can sync other variables with it.
  • Make the entity save hook save freshly selected values to avoid race conditions when making "function edits". I.e. when we set a property to a function that serializes blocks to avoid serializing on every change. This change will also just make the hook more resilient under any conditions.
  • Export the serialization utility from the editor package so that blocks can use it.

How has this been tested?

These changes were extracted from #17263, where they were verified to work. They also should not break any existing functionality and will facilitate the parallel development of most full site editing blocks like Post Content and Template Part.

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows the accessibility standards.
  • My code has proper inline documentation.
  • I've included developer documentation if appropriate.
  • I've updated all React Native files affected by any refactorings/renamings in this PR. .

@epiqueras epiqueras added this to the Future milestone Nov 26, 2019
@epiqueras epiqueras self-assigned this Nov 26, 2019
@epiqueras epiqueras requested a review from aduth November 26, 2019 02:24
@epiqueras epiqueras force-pushed the add/entity-synced-inner-blocks-apis branch from f723607 to 4644703 Compare December 4, 2019 20:13
@epiqueras
Copy link
Contributor Author

This was merged as part of #19203.

@epiqueras epiqueras closed this Jan 20, 2020
@youknowriad youknowriad deleted the add/entity-synced-inner-blocks-apis branch January 21, 2020 08:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Package] Block editor /packages/block-editor [Package] Core data /packages/core-data [Package] Editor /packages/editor
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant