-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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 Library: Implement template blocks using nested block editors. #17118
Block Library: Implement template blocks using nested block editors. #17118
Conversation
c6ca4e7
to
76f0a7b
Compare
Thanks for opening the PR Enrique, I really appreciate your willingness to try different approaches.
While this is not critical for a block with a separate save flow (reusable blocks), this definitely feels like a lot especially for a block that is meant to be saved with the same global flow. I think I agree with you that we might not want to introduce these issues. And we have some options on the table: Do you think there's a potential approach with these in mind:
This also means we might have to do some tweaks to the What do you think of such approach? |
Oh, on another subject. I think so "split" this PR somehow, do you think we can do this in a separate PR:
It feels like something we could try and ship quicker without going into the "template" rabbit hole yet? |
😄
Although I see why conceptually this seems "more correct", there would be no practical benefit over #17020. That approach of a single block list with multiple syncing levels has all the properties we need, blocks are transient edits anyway.
It sounds like you are describing #17020, but with
That's what #17020 does.
Yeah we can do that once we agree on an approach. |
The main issues I have with #17020 are:
I think there's a big conceptual benefit here, especially I believe (If I understand properly) in #17020 we store all blocks (from all entities) in the root entity then we store the second level and all its children level in the second entity, then we store ... until we reach the leaf level right? Don't you think there's a lot of duplication here? While in my proposal here, there's also duplication (but it's just one time) not duplicating on each sublevel. |
We can change that and also allow having one provider per entity type like in this PR, which I think is pretty useful.
It's useful because we can reuse a lot of the logic for syncing blocks to an entity, although after implementing the previous point, I think blocks should explicitly render the editor provider just like reusable blocks explicitly render block editor providers.
Yes, but
They are the same objects, so it's not using more memory. I think I am leaning towards an approach like this PR except that instead of rendering a nested |
I like that yes
I still don't like that, that much, I mean I can see how my proposal is a bit more complex that this but having this weird "edit" in the code-data still feels wrong. That said, we can start with the above and address that point a bit later. |
Ok, I'll see how this goes. |
76f0a7b
to
04a27ce
Compare
Closed in favor of #17153. |
Description
This PR is an alternative approach to #17020 for providing entity context to blocks and implementing template blocks that sync to different entities.
Instead of syncing inner blocks to different entities like #17020, this PR leverages the work of @youknowriad's reusable block refactor (#14367), and uses nested block editors instead. This provides for a simpler implementation, albeit at the cost of breaking up the block list. This means we lose block navigation, simple drag and drop/moving, block inspectors, save flow/change detection UI, integrated undo UI, etc.
How has this been tested?
The blocks were tested manually to work as expected.
Types of Changes
New Feature: Implement new template blocks: Site Title, Post, Post Title, and Post Content.
Checklist: