-
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
Editor: Unify the list view sidebar between the post and site editors #57467
Conversation
Size Change: -125 B (0%) Total Size: 1.69 MB
ℹ️ View Unchanged
|
@@ -59,7 +58,7 @@ import TemplatePartConverter from '../template-part-converter'; | |||
import { useSpecificEditorSettings } from '../block-editor/use-site-editor-settings'; | |||
|
|||
const { BlockRemovalWarningModal } = unlock( blockEditorPrivateApis ); | |||
const { ExperimentalEditorProvider: EditorProvider } = | |||
const { ExperimentalEditorProvider: EditorProvider, ListViewSidebar } = |
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 was already there, but I guess it's not needed to call it ExperimentalEditorProvider
if it's a locked API?
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.
I think the reason is that we have a stable and a private one.
660bb47
to
7c892c5
Compare
7c892c5
to
44db06c
Compare
Am I supposed to see the document outline in the site editor? I can't see it when loading a post template |
@ellatrix you mean you see the tab but it's empty right? I'm guessing we may not be targeting the right document, I'll check. |
It's strange that the word count etc is correct, but there's no outline |
@ellatrix Yeah, it seems the same issue already exist in trunk for the post editor too. Basically, the document outline just retrieves the blocks that are in the root block editor which means it will be wrong when "template preview" is enabled. I'll see if it's fixable quickly here, otherwise, I'll leave it separate as existing issue. |
@ellatrix The document outline should be fixed now ✅ |
const { getPostType } = select( coreStore ); | ||
const postType = getPostType( getEditedPostAttribute( 'type' ) ); | ||
|
||
return { | ||
title: getEditedPostAttribute( 'title' ), | ||
blocks: getBlocks(), | ||
blocks: getEditorBlocks(), |
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 does make me wonder if we should include the post title and site title blocks here at some point. Not sure if that makes sense. Perhaps then we should also include article and section boundaries I guess.
Actually there's one more small bug: when you click on the headings in the outline, it doesn't scroll to/select the heading in the editor. |
(And this is working in trunk in the post editor.) |
@ellatrix That's a bit harder to fix. Basically, when using |
You can notice that as soon as you edit the post/page, clicking the headings work again. |
@ellatrix So it turns out that the issue is even more complex. I initially thought #57500 this would solve it but it won't solve it for the case where "template preview" is enabled (site editor by default or by toggling it in the post editor). The reason is that useBlockSync clones the blocks, so the blocks we have in "core" store are different from the ones we have within the "block editor". We need to "match" the blocks from the outside. In other words, given a "postId", we need a way to extract the blocks that corresponds to that post id from within the "block-editor" block list and I'm not sure how we can do that. So for now and to avoid blocking this PR, I'm considering one of these options:
|
After some thinking, I've restored the trunk behavior for now. Only difference between post and site editors is that one lands in "template preview mode" by default and other doesn't. |
Related #52632
Similar to #57466
What?
This PR continues the work on the great unification between post and site editors. This PR unifies the InserterSidebar component between edit site and edit post.
Worth noting that this PR means the "document overview tab" is also present in the site editor (it was not available there previously).
Testing instructions