-
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
Introduce section container selection when assembling patterns (zoom out mode) #59249
Conversation
packages/block-editor/src/components/block-list/disable-non-main-blocks.js
Outdated
Show resolved
Hide resolved
e1f846b
to
969787e
Compare
Size Change: +1.6 kB (0%) Total Size: 1.75 MB
ℹ️ View Unchanged
|
86ee03f
to
5718e9f
Compare
packages/block-editor/src/components/block-list/use-zoom-out-block-editing-mode.js
Outdated
Show resolved
Hide resolved
This comment was marked as outdated.
This comment was marked as outdated.
e7b0cf7
to
83bb613
Compare
I have rebased this. It needed some manual conflict res so I hope nothing is broken. It does test very well. |
fc571b4
to
bb81502
Compare
This tests actually quite well. @getdave I'm curious, what we need to do to get this tidied up? |
One thing to explore would be to keep these accessible within List View, so you can still select + shuffle headers and footers; we'd just keep them pinned to the top and bottom, per #60054. |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
c377098
to
85d3814
Compare
0f5170f
to
9e5640a
Compare
packages/editor/src/components/provider/use-block-editor-settings.js
Outdated
Show resolved
Hide resolved
baec558
to
3af6938
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copied over the remaining review comments from #60609 so we don't have to go back and forth for them.
return null; | ||
} | ||
|
||
if ( [ 'post', 'page' ].includes( contextPostType ) ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copied from #60609 (comment).
These are not the only content types so I'd prefer if remove this. I'd rather do the following algorithm instead:
1- If mode = "template-locked": look for post-content block
2- If mode is not "template-locked', look for the "main" group block
3- fallback to top level. (undefined section container I guess)
packages/editor/src/components/provider/use-block-editor-settings.js
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The original PR has been iterated on to:
- transform the concept of section id from a state concept to a setting in block editor
- make sure the block editor remains decoupled conceptually from editor
- apply block editting modes as efficiently as possible
- make the zoom out mode display an assembly like interaction, if there is a section root found and even if there is no section root found
- make sure the assembly interaction works for pages and templates alike
- remove unrelated updates, such as the behavior of list view
I think this can safely land, the new block editor setting is locked and there doesn't seem to be any remaining conceptual, performance or code quality concern.
@@ -70,6 +73,7 @@ const BLOCK_EDITOR_SETTINGS = [ | |||
'postContentAttributes', | |||
'postsPerPage', | |||
'readOnly', | |||
'sectionRootClientId', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it need to be declared here if it's locked?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like it doesn't need to be declared here if it isn't part of the parent settings that we want to include.
What?
This PR introduces the notion of a section root block, much like we have the grouping block. This is the root block of all sections. By default this root is a group block with the tag
main
, but in certain contexts editors would want to set it to something else. For example the site editor while editing a page will set the section root block to be the post content block since that's where the sections are.In Zoomed out mode:
Testing Instructions
Screenshots or screencast
Screen.Capture.on.2024-02-21.at.16-52-43.mp4