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

Merge the block navigation and the document outline in the same popover/panel #14956

Closed

Conversation

youknowriad
Copy link
Contributor

@youknowriad youknowriad commented Apr 12, 2019

closes #20719
closes #13587

I find that there's a lot of redunduncy between the document outline panel and block navigation one. I think the minimum we can do here is to unify these two features under the same panel. Also I think the topbar is a bit crowded and less buttons there help a little bit.

This is a very exploratory PR at the moment but I'd love some early feedback. cc @jasmussen @mapk @mtias

Capture d’écran 2019-04-12 à 3 17 14 PM

@@ -0,0 +1,43 @@
.components-tab-panel__tabs {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was surprised that the "TabPanel" component doesn't include any styling by default. I added basic styling here, I think this is needed regardless of this PR but may require a dev note.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is an issue filed: #13587

@@ -5,6 +5,7 @@ export { default as BlockAlignmentToolbar } from './block-alignment-toolbar';
export { default as BlockControls } from './block-controls';
export { default as BlockEdit } from './block-edit';
export { default as BlockFormatControls } from './block-format-controls';
export { default as BlockNavigation } from './block-navigation';
export { default as BlockNavigationDropdown } from './block-navigation/dropdown';
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This dropdown won't be used anywhere in Gutenberg. I feel like we can probably safely remove it as I don't think third party developers would need this but since it's part of the public API, I kept it for now.

@jasmussen
Copy link
Contributor

jasmussen commented Apr 12, 2019

Love this, thanks so so so so much for tackling this.

I will give this a much deeper spin as soon as I can, but judging purely by the screenshot, here are some early vague thoughts to ponder:

  • The block navigation is more important than the outline, so its icon should be used, and if we tab this interface it should be the default tab
    -- An additional benefit to using the Block Navigation icon, is that we finally address the "circle / undo / redo / circle" goggle visual that the four buttons made up :)
  • Is there a way we can simplify the document outline interface, so that we don't need to tab it? The actual document outline with headings and such seems like it could be integrated into the actual block navigation tree.

I will return with more refined thoughts, but those are early instincts.

@mapk
Copy link
Contributor

mapk commented Apr 27, 2019

Thanks Riad! They both do seem very related.

The actual document outline with headings and such seems like it could be integrated into the actual block navigation tree.

I was thinking the same thing. Here's an idea on bringing them together. It's a first pass and not much to get excited about. But clicking the block would highlight that block in the editor just like the Block Navigation did. I still kept the "Document Outline" title, but just used the Block Navigation icon.

Document Outline

@jasmussen
Copy link
Contributor

I love that, Mark! ƪ(˘⌣˘)┐ ƪ(˘⌣˘)ʃ ┌(˘⌣˘)ʃ

@gziolo
Copy link
Member

gziolo commented Apr 29, 2019

I like this proposal, it needs to take into account a few more things as it is more complex as it seems at first glance. I'm sharing 3 screenshots to better illustrate them:

When a block with nested blocks is selected:
Screen Shot 2019-04-29 at 10 23 32

Block Navigation with a couple of Heading blocks:
Screen Shot 2019-04-29 at 10 23 40

Document Outline with the same set of Heading blocks:
Screen Shot 2019-04-29 at 10 23 50

@youknowriad
Copy link
Contributor Author

@mapk Nice proposal, I like it. Maybe we could offer a toggle to switch between the "table of contents" and the block list.

@jasmussen
Copy link
Contributor

Maybe we could offer a toggle to switch between the "table of contents" and the block list.

Is there any reason they cannot be merged?

@youknowriad
Copy link
Contributor Author

@jasmussen my thinking is that people want to see only the headings (table of contents) of their post without necessarily having to scroll the dozens of paragraph blocks between each heading?

@jasmussen
Copy link
Contributor

my thinking is that people want to see only the headings (table of contents) of their post without necessarily having to scroll the dozens of paragraph blocks between each heading?

That's a fair point. In that case, we'll want to make sure the navigation tab is the default one, as it's the most important.

@mapk
Copy link
Contributor

mapk commented May 20, 2019

I wanted to address some of the details pointed out by @gziolo and see if a merged version of these can still work when more complexity is involved.

Document Outline v2

While I do believe it gets a bit more complex, I think it still works.


my thinking is that people want to see only the headings (table of contents) of their post without necessarily having to scroll the dozens of paragraph blocks between each heading?

One solution could be to introduce a toggle to turn off the detail view?

contents

@jasmussen @youknowriad any thoughts? Are you still in favor of keeping them separate tabs?

@jasmussen
Copy link
Contributor

I think that's a clever solution, Mark. Instead of having two interfaces that look virtually identical, with tabs, confusing users which is which, this merging of the two clearly indicates what the difference is.

I'm not totally convinced what the best visual location for that checkbox or switch is — I would defer to good feedback on that, but the primary thing that stands out is that it's on the right there, and usually we have it on the left. But I'm personally flexible on that, just need a sanity check.

@gziolo
Copy link
Member

gziolo commented May 21, 2019

I wanted to address some of the details pointed out by @gziolo and see if a merged version of these can still work when more complexity is involved.

Document Outline v2

I like it a lot and I would be more than happy to see it implemented this way. I see the vertical line which connects nested blocks which is very important to have a way to distinguish from Heading blocks which can themselves create tree view as well. I think this is the only challenge in this proposal. To make it clear, I'm talking about having H2, H3, H4 at the same nesting level where each of them should have different padding to resemble a table of contents like here:

Screen Shot 2019-04-29 at 10 23 50

Unless we ignore it in the detailed view and apply those paddings for heading levels only in the simplified view.

I'm not totally convinced what the best visual location for that checkbox or switch is — I would defer to good feedback on that, but the primary thing that stands out is that it's on the right there, and usually we have it on the left. But I'm personally flexible on that, just need a sanity check.

Yeah, good point. In Block Manager we moved all checkboxes to the left to align with the rest of UI. On the functional side, we should persist the selection of this toggle between page loads.

@youknowriad
Copy link
Contributor Author

I like the toggle but I'm still uncertain about merging the two panels because of how headings are treated.

In your example, a heading in the columns block is hidden unless you show everything while in reality if you're a user and you want to see a table of contents (headings) of your post, you don't care if these are inside columns or not (these are just "design" elements).

At the same time, in a block hierarchy view, it's important to know that a heading is inside a columns block.

which makes me wonder if the two features are mergeable

@mapk
Copy link
Contributor

mapk commented May 22, 2019

I've revised the prototype and worked in the concerns.

I'm talking about having H2, H3, H4 at the same nesting level where each of them should have different padding to resemble a table of contents like here:

I've accounted for this now.

In your example, a heading in the columns block is hidden unless you show everything while in reality if you're a user and you want to see a table of contents (headings) of your post, you don't care if these are inside columns or not (these are just "design" elements).

Very true. I missed that on the first go. Here is the updated version showing ALL heading levels.

contents

Play with the prototype.

@jasmussen
Copy link
Contributor

This feels very compelling.

@gziolo
Copy link
Member

gziolo commented May 23, 2019

@mapk - yes, this is great and addresses all my concerns. Let's ship it 🚀

@tomjn
Copy link
Contributor

tomjn commented May 23, 2019

I can foresee being able to pin this to the left as a sidebar on large screens might be useful

@jwold
Copy link

jwold commented May 23, 2019

I really like this change. From a design perspective this feels really easy to use. Great work!

@mapk mapk added Needs Dev Ready for, and needs developer efforts and removed Needs Dev Ready for, and needs developer efforts labels May 24, 2019
@mapk
Copy link
Contributor

mapk commented May 24, 2019

@youknowriad would you be up for making these latest changes in the PR?

@youknowriad
Copy link
Contributor Author

Yes, I have this on my mind. Hopefully, next week I'll get back to it.

@swissspidy swissspidy added the [Feature] Document Outline An option that outlines content based on a title and headings used in the post/page label May 28, 2019
@gziolo gziolo added the [Feature] List View Menu item in the top toolbar to select blocks from a list of links. label Jun 14, 2019
@diggeddy
Copy link

With the new Group Block and other 3rd party section blocks it would be a benefit to have a custom block label within the blocks advanced setting that is displayed in the Block Navigation. This would allow 'groups' to be more easily identified especially when viewing the root level of the navigator.

@youknowriad
Copy link
Contributor Author

@jasmussen Do you have the desired icon at hand?

@jasmussen
Copy link
Contributor

No, and I don't personally think it's necessarily a blocker to have it at hand. So long as we are ready and willing to update the icon when it lands. Which of course we are! Just wanted to explicitly acknowledge the feedback.

@youknowriad
Copy link
Contributor Author

I think this PR is ready merge soonish.

I'll need this merged to use the TabPanel styles in a follow-up PR.

@mcsf
Copy link
Contributor

mcsf commented Mar 13, 2020

For now I'm not super excited about the change, but it's more of a personal impression that Navigation and Content are sufficiently different to keep them separate. This isn't informed criticism, and I don't feel strongly about it. :)

However, this change does highlight something that has been an issue in Navigation for a while: that it can become awkward when Navigation becomes rooted in a nesting block (Columns, Cover, etc.) while Content remains global in scope.

nav-vs-content

@jasmussen
Copy link
Contributor

I'm a fan of this PR. I think that the two are related enough that they deserve to belong together. Although Miguel has a point with the changing scope of the navigation, that feels like an issue even today before merge, and something that can be solved separately either through never limiting scope, or through finding a way to show an indicator to go "back" to the full scope right in that menu.

Icon wise, we should watch closely the conversation on #20719, and follow up depending on how that ends.

Until we find an agreement on the icon there, though, we should go with this icon:

Screenshot 2020-03-13 at 14 06 31

I would throw my thumbs up to this as a good first step to try in the plugin — if you change to that icon first :)

@mcsf
Copy link
Contributor

mcsf commented Mar 13, 2020

that feels like an issue even today before merge, and something that can be solved separately

Definitely! It's bugged me for a while; it just becomes a bit more awkward now. :)

Please keep the ball moving and see what feels best, though.

@youknowriad youknowriad force-pushed the try/merge-block-navigation-document-outline branch from 1d21c31 to 759710b Compare March 13, 2020 15:25
@mapk
Copy link
Contributor

mapk commented Apr 14, 2020

Here's my current experience.

outline

Seems I'm missing the Document Outline from the Content tab. Is that correct?

@jasmussen
Copy link
Contributor

Seems I'm missing the Document Outline from the Content tab. Is that correct

Do you have more than one heading in the body of the text? It will only show up if you have headings, I made this mistake myself a couple of times.

@paaljoachim
Copy link
Contributor

Any thoughts on testing out a version of @mapk Mark's prototype here?
#14956 (comment)

As it would be nice to have some movement here..:)

@SchneiderSam
Copy link

I like it very much. This is related: https://wptavern.com/block-navigation-plugin-provides-missing-context-based-outline-for-the-wordpress-editor

@jasmussen
Copy link
Contributor

CC: @jameskoster

@jameskoster
Copy link
Contributor

I was originally unsure of this idea, but when I tried to come up with a more appropriate place for the word count / document outline I could not, without redesigning the entire Top Bar 😭

This change might align nicely with the block navigation adjustments I shared in #27395

@diggeddy
Copy link

diggeddy commented Jan 9, 2021

Heading and Paragraph count only considers core Text and Heading blocks in the current document outline.
HTML text elements added in a HTML block or 3rd party blocks that add there own Text/Typography blocks are not counted.
How are they being counted and can elements outside of core blocks be considered?

@dynamic-david
Copy link

dynamic-david commented Jan 9, 2021

Regarding what @diggeddy said about third party blocks that are h1, h2, etc headers under their hoods are not included in the document outline, I was wondering would it be possible to include them based on the usual html tags for headers eg h2 rather than what I suspect is being currently used eg wp:heading comment.

That would then include those headers both in the counts for headers and in the document outline section as well.

I have also noticed that the paragraph count does not include third party blocks that are paragraphs under their hood. I have noticed at least one third party block that is defined as a "headline" (third party term) that can be specified as a heading (h1, h2, etc) or as a paragraph in that instance.

The counts would need to increment based on the underlying type (h1, h2, etc or paragraph).

tableofcontentspanel

@gchtr
Copy link
Contributor

gchtr commented Feb 12, 2021

No idea whether this is the right place to comment, because there are quite a few open issues and pull requests about the document outline, but I’m going to respond to @dynamic-david’s comment here.

I was wondering would it be possible to include them based on the usual html tags for headers eg h2 rather than what I suspect is being currently used eg wp:heading comment.

Currently, it’s only a check for core/heading blocks:

( block ) => block.name === 'core/heading'

I’m not sure if using the actual HTML tags would work. There can be headings that are only used for the UI, but no in the post content itself. Here’s an example for a location post type where I can save data about a location:

grafik

The block editor has two blocks areas. One for post data saved in meta or a block attributes and one for typical post content, where you can add your own blocks which will be used for the frontend content of a location:

grafik

The headings in Location Post Content would have to be counted, but not the ones for the Location Post, which are only used in the UI.

I would like it very much if there could be a way for heading blocks to tell the block editor that they should be considered in the document outline, possibly through a value that can be passed in the block registration.

@ZebulanStanphill
Copy link
Member

@gchtr

I would like it very much if there could be a way for heading blocks to tell the block editor that they should be considered in the document outline, possibly through a value that can be passed in the block registration.

There's been some discussion about this in #22874.

Base automatically changed from master to trunk March 1, 2021 15:42
@priethor priethor mentioned this pull request May 28, 2021
12 tasks
@youknowriad youknowriad deleted the try/merge-block-navigation-document-outline branch June 11, 2021 10:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Document Outline An option that outlines content based on a title and headings used in the post/page [Feature] List View Menu item in the top toolbar to select blocks from a list of links. [Type] Enhancement A suggestion for improvement.
Projects
None yet