Skip to content
This repository has been archived by the owner on Jul 28, 2023. It is now read-only.

⚛️ Get rid of the <wp-block> wrapper #72

Merged
merged 7 commits into from
Sep 21, 2022

Conversation

DAreRodz
Copy link
Collaborator

This PR removes the <wp-block> wrapper and, instead, appends all wp block attributes to the element's attributes where blockProps are rendered.

The technique is a bit hacky because:

  1. there is no way to render those attributes during save, as most of the required information is not available
  2. attributes are appended to the block element modifying the saved content with grep_replace(), using a RegExp that could not be reliable enough.

Copy link
Member

@luisherranz luisherranz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great to me. Looking forward to the day we have the WP_HTML_Walker available for these HTML injections 🙂

It may be worth noting that this would only work if we enforce blocks to have a single node wrapper. Maybe we need to add that to the requirements in the README.

@luisherranz
Copy link
Member

Maybe we need to add that to the requirements in the README.

Added in 110dcbf.

@DAreRodz DAreRodz merged commit d04ee91 into main-full-vdom-hydration Sep 21, 2022
@DAreRodz DAreRodz deleted the full-vdom/remove-wp-block-wrapper branch September 21, 2022 13:52
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants