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

Full Site Editing: Post content block is removable [5] #34331

Closed
mmtr opened this issue Jun 27, 2019 · 1 comment · Fixed by #34425
Closed

Full Site Editing: Post content block is removable [5] #34331

mmtr opened this issue Jun 27, 2019 · 1 comment · Fixed by #34425

Comments

@mmtr
Copy link
Member

mmtr commented Jun 27, 2019

When editing a full site page, we should make the post content block unremovable in order to avoid having pages without, well, content 😄.

Apart from losing the content, if a user remove the a8c/post-content block will result in an editor with the post title missing, given that since #34296 we're rendering the post title as part of the post content block when editing a full site page (and adding a show-post-title-before-content class to the body element that would keep the regular editor post title hidden).

@vindl vindl changed the title FSE: Post content block is removable FSE: Post content block is removable [?] Jun 27, 2019
@vindl vindl changed the title FSE: Post content block is removable [?] Full Site Editing: Post content block is removable [?] Jun 27, 2019
@vindl vindl added this to the Cylon+Serenity Sprint [27-28] milestone Jun 27, 2019
@kwight
Copy link
Contributor

kwight commented Jun 28, 2019

I guess we'd need to add some UI explaining this to the user also.

@gwwar gwwar changed the title Full Site Editing: Post content block is removable [?] Full Site Editing: Post content block is removable [5] Jul 1, 2019
@mmtr mmtr self-assigned this Jul 3, 2019
@mmtr mmtr assigned mmtr and unassigned mmtr Jul 5, 2019
vindl pushed a commit that referenced this issue Jul 9, 2019
This PR replaces the block inserter in the header toolbar
with a custom one that ensures that new blocks are appended
inside the post content block.

Since the default inserter in the header toolbar rendered by
Gutenberg doesn't set any rootClientId, we cannot define which
block should contain any new inserted block.

This PR aims to solve that by rendering a replica of the same
header inserter but using the client id of the post content block
as rootClientId. The same client id is also used now when inserting
a starter page template to avoid that content being appended after
the footer (#34330).

In order to don't display the default header inserter, we lock the
template making impossible to insert new blocks in the root
(thus the header doesn't show the default block inserter).
But this also prevents the user from removing existing blocks,
which solves the issue of having the post content block
removable (#34331).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants