- Issue created by @stefdewa
- Merge request !32Add support for specifying classes for the list element (UL/OL). → (Merged) created by stefdewa
- 🇫🇷France mably
Hi @stefdewa, thanks for your MR 👍
Could you explain a bit more in detail your need for this new configuration option ?
- 🇧🇪Belgium stefdewa
Sure, no problem!
We are creating a sticky ToC that can be navigated like a slider. For that, we are combining this awesome toc_js module with a custom splide component. (Splide is a lightweight slider/carousel library, more info at https://splidejs.com/ ). The Toc.js module handles the automatic ToC generation and the splide component handles the slider behaviour.
A requirement for using the splide component is that specific classes are set on both the list (UL) and on the list items (LI). Adding classes on the list items is already possible, but adding classes on the list was not yet possible. Because adding classes was already possible for list items, it seems feasible that it would be OK to have this possibility for the list itself. Therefore, I added it here as a new feature.
Feel free to ask for more information if you need any!
- 🇫🇷France mably
@stefdewa looks like we have a problem when the list CSS settings field is left empty:
Uncaught SyntaxError: Failed to execute 'add' on 'DOMTokenList': The token provided must not be empty. at HTMLHeadingElement.<anonymous> (tocjs.js?soc642:376:22)
Would you mind having a look at it? Probably simple to fix.
- Merge request !33Issue #3493158 by stefdewa, mably: follow-up: fix when list element class field is empty → (Merged) created by mably
- 🇧🇪Belgium stefdewa
Sorry I didn't test it properly with empy values. Your MR looks good to me. I tested the list_classes configuration on my end with NULL, an empty string '', a string with one class and a string with multiple classes. This all works and the ToC keeps being generated without any erros in console.