RedEchidnaUK / Table-of-Contents

Creates a Table of Contents on SharePoint Online Modern pages based on the heading tags in the standard Text web part. This has not been tested with standalone SharePoint, but it may work.
MIT License
10 stars 4 forks source link

Suggestions on potential improvements #5

Closed Dahnic closed 9 months ago

Dahnic commented 1 year ago

Great work here, really like this webpart, esp. the sticky part. I've tested it with some internal users and I have som feedback on suggested improvements:

  1. Make the headings expandable/collapsible.

    • For lengthy, long scrolling pages it would make sense if it was possible to expand and collapse the headings under level 1 to give a better overvoew and visibly show the user at which point on the page they are at.
  2. UX The underscore for a mouseover is nice, but slightly lackluster, would it be possible to enahnce it more, perhaps a staying effect on the last item clicked? Also the stylechange on the bullets where not something that the users liked, they would rather see them being consistent or not at all.

  3. Placing of "Return ot previous page" Iit is good that one can chose to toggle on and off certain features, like the return to next page, but what would make it even better is if the user could decide if it should be at the top or the bottom of the TOC, preferrable above the title. Perhaps just duplicating the feature and make the user able to have it both at the top and the bottom if they wish? Would exp. cater to the really lengthy TOCs where the user either has scrolled all the way to the bottom, or just instantly wants to go back.

RedEchidnaUK commented 1 year ago

Hi,

Thanks for the feedback. In all honesty, I probably won’t have time to look at this request in the near future, but here are some comments on the feedback.

  1. A nice idea, but probably a good amount of work, so I’m not sure if this will ever happen.

  2. I might look at this. With regards to the bullet styles, they actually use the SharePoint CSS to follow the site, but it should be possible to put in an override that could be toggled on/off.

  3. This should be possible without too much work.

Of course, if anyone wants to do the work and put in a pull request, I’m more that happy to take a look at including the changes.

oxygenson commented 10 months ago

Hi @RedEchidnaUK ,

as MS recently updated the Text WebPart on a modern page and excluded Heading 1, now toc should include heading 4 for that matter.

How easy would it be possible to update this by pushing all headings one level up? Where heading 2 in webpart would be a heading 1 in toc heading 3 in text webpart would be a heading 2 in toc and heading 4 would be heading 3 in toc.

Probably I'm going to take a look at it myself as well :)

Thank you.

RedEchidnaUK commented 10 months ago

Hi @oxygenson

The code already uses Heading 2 etc. and always has done. The change MS made was purely a graphical one as it's always been Heading 2 etc. behind the scenes in the HTML. I suppose the ToC configuration options should really say 'Heading 2' etc. rather than 'Heading 1' to avoid confusion, or perhaps it should just say 'Contents level 1' etc. for when MS change everything in the future.

oxygenson commented 10 months ago

Hi @RedEchidnaUK , Thank you for confirmation!

This issue was reported to me through a user when H1 disappeared. After a detailed check with them and your solution, I came to the same conclusion you explained, all works fine. Too bad only SP page doesn't have additional headings, three levels only is a bit harsh when writing documentation.

Thank you and appreciate your solution, especially the sticky feature.

RedEchidnaUK commented 9 months ago

@Dahnic I know it's been a long time since you requested some changes, but I have now implemented some of your requests in the latest version; the ability to change the list icons (including hide them) and the ability to choose where the 'Return to previous page' link is shown. Unfortunately, the other requests would require significant work and I just don't have the time at the moment.