[TikiWiki-commits] [Git][tikiwiki/tiki][29.x] [BP][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 | <690bd4194873b_2c322457c606dd@gitlab-sidekiq-low-urgency-cpu-bound-v2-54c56b4c4d-vjsf8.mail> |
luci pushed to branch 29.x at Tiki Wiki CMS Groupware / Tiki
Commits:
f4997810 by Doddy MATABARO at 2025-11-05T22:40:52+00:00
[BP][FIX] Restore automatic Table of Contents on wiki pages (regression)
---
* [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
See merge request tikiwiki/tiki!8929
- - - - -
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/f4997810bbb1c6c6ac9cabe58672675c7ff0b8a3
--
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/f4997810bbb1c6c6ac9cabe58672675c7ff0b8a3
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