-
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
Expanding the Editor outside of post_content #16281
Comments
Also #11553 |
I'd love to see this extended to the "post header" area. The screenshot below is from one of my blog posts. What I've been doing is faking a post header block by creating a custom page template that doesn't show the post header. Then, I re-add a The problem with this method is my entry byline/meta disappears unless I manually add that too. What we need is an opt-in for themes to have post header support. And, the entire post header area needs to be considered, not just the post title. |
@justintadlock indeed, that's next to come. We'd need to figure out the best way to store these template parts and the best way to handle editing while saving to different sources (global and local). Starting with the title only helps constrain the context to just the post, so we don't yet need to solve global content. It'd be good to start formalizing how the template parts should be represented (block areas / theme areas) separately, though. |
I think I have a pretty clear idea of how we can move forward with this. What does everyone think of the following changes: PersistenceChange this to save to a template CPT:
Fetch and pass down the template CPT here: gutenberg/packages/edit-post/src/editor.js Line 124 in 0a3c5c0
Editor SetupPass the template down to here:
Defaulting to [ { name: 'core/post-title', attributes: { ... } }, { name: 'core/post-content', attributes: { ... } } ] if none is available. It will setup the block list so that template parts become the top level blocks. E.g.: The default template would produce a block list with two top level blocks. Both of these would need to leverage custom attribute sources (#16282).
Note that the fact that these two top level blocks produce no markup is because templates are shared between posts. They will store where the post content is rendered, but not the post content itself: <!-- wp:post-title /-->
<!-- wp:post-content /--> Templates could also have arbitrary blocks, like for sidebars for example: <!-- wp:post-title /-->
<!-- wp:post-content /-->
<!-- wp:group -->
<div class="sidebar">
<!-- wp:paragraph -->
<p>About </p>
<!-- /wp:paragraph -->
<!-- wp:latest-post /-->
</div>
<!-- /wp:group --> They could also use reusable blocks to share content across different templates. Next StepsThis is still kind of abstract, but I wanted to get the ball rolling on how this would be best implemented. It looks like most of the work here is in solving #16282. I will start syncing with @aduth on how this can be done. I have not started to think about that too much yet, but I'm guessing something like action hooks that can be registered for I'm super excited for this feature and can't wait to see it land! |
This sounds like a great plan @epiqueras I'd suggest to avoid thinking about persistence at first. We could build the JS bits relying on a static template and memory updates only. This would allow us to think about how to support a "locked" template (the current UI). |
@youknowriad Yeah, that was the plan. Here's what we discussed with @aduth today: #16282 (comment). |
In reference to my feature request. I think that's related to this issue. |
I think this issue can be closed now. For the FSE work refer to #20791 now. |
One of the main important requirements to build a full site editing experience is the ability, for the block editor to edit both the post/page object and its associated block template at the same time.
The current implementation of the
EditorProvider
component makes an important assumption that need to be reconsidered:post_content
post object's property.For full site editing, the list of blocks to be edited is extracted from the template object instead and "augmented" using the blocks stored in post_content if needed (if a
core/post-content
block is used in the template).The initial step to achieve the required flexibility here is to consider the editor screen as it exists today as an editor built around a frozen block template composed of two blocks: A post title block and a post content block.
Related #16075 #13489
The text was updated successfully, but these errors were encountered: