[TikiWiki-commits] [Git][tikiwiki/tiki][master] [FIX] Restore automatic Table of Contents on wiki pages (regression)
"luci \(@luciash\) via TikiWiki-cvs" <[email protected]>
| Newsgroups | gmane.comp.cms.tiki.cvs |
|---|---|
| Message-ID | <69028d9119708_2c4614b4693f9@gitlab-sidekiq-low-urgency-cpu-bound-v2-659d96848d-7sxdq.mail> |
luci pushed to branch master at Tiki Wiki CMS Groupware / Tiki
Commits:
e154570f by Doddy MATABARO at 2025-10-29T21:48:46+00:00
[FIX] Restore automatic Table of Contents on wiki pages (regression)
---
* [FIX] Restore automatic Table of Contents on wiki pages (regression)
See merge request tikiwiki/tiki!8904
- - - - -
1 changed file:
- lib/jquery_tiki/autoToc.js
Changes:
=====================================
lib/jquery_tiki/autoToc.js
=====================================
@@ -48,8 +48,20 @@ $.genAutoToc = function () {
if ($top.length && location.href.indexOf("tiki-print.php") == -1) {
var selector = '#page-data';
- var container = document.querySelector(container) || document.querySelector(selector);
+ var container = document.querySelector(selector);
+ if (! container) return;
var children = container.children;
+ var allHeadings = container.querySelectorAll('h1,h2,h3,h4,h5,h6');
+ if (countHeadings(children) < allHeadings.length) {
+ if (toc_tabs !== 'yes') {
+ children = Array.prototype.filter.call(
+ allHeadings,
+ function(h){ return !h.closest('.tab-content'); }
+ );
+ } else {
+ children = allHeadings;
+ }
+ }
if (toc_tabs === 'yes') {
@@ -92,6 +104,7 @@ $.genAutoToc = function () {
}
+ children = Array.from(new Set(Array.prototype.slice.call(children)));
if (countHeadings(children) > 0) {
$row = $("<div class='row'/>");
@@ -326,4 +339,4 @@ $(function () {
'scrollTop': $target.offset().top
}, 900, 'swing', function () {});
});
-});
\ No newline at end of file
+});
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/e154570f90a3c2703630de25b05c168330d7fddb
--
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/e154570f90a3c2703630de25b05c168330d7fddb
You're receiving this email because of your account on gitlab.com.
_______________________________________________
TikiWiki-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tikiwiki-cvs