aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2022-01-09 20:44:30 +0000
committerMario <mario@mariovavti.com>2022-01-09 20:44:30 +0000
commit5b50454b4de665a93d95ce368929ae924e3cfc46 (patch)
tree05201b1983fa27be86f354a1fc183d157c9b3ead /include
parentb5e4c08fc531cfe057f6ebaa0852b4e89336a181 (diff)
downloadvolse-hubzilla-5b50454b4de665a93d95ce368929ae924e3cfc46.tar.gz
volse-hubzilla-5b50454b4de665a93d95ce368929ae924e3cfc46.tar.bz2
volse-hubzilla-5b50454b4de665a93d95ce368929ae924e3cfc46.zip
make toc bbcode find its own container by default
Diffstat (limited to 'include')
-rw-r--r--include/bbcode.php2
1 files changed, 1 insertions, 1 deletions
diff --git a/include/bbcode.php b/include/bbcode.php
index 6a1a5a01e..fd92af61e 100644
--- a/include/bbcode.php
+++ b/include/bbcode.php
@@ -1400,7 +1400,7 @@ function bbcode($Text, $options = []) {
// Check for table of content without params
while(strpos($Text,'[toc]') !== false) {
$toc_id = 'toc-' . random_string(10);
- $Text = preg_replace("/\[toc\]/ism", '<ul id="' . $toc_id . '" class="toc" data-toc=".section-content-wrapper"></ul><script>$("#' . $toc_id . '").toc();</script>', $Text, 1);
+ $Text = preg_replace("/\[toc\]/ism", '<ul id="' . $toc_id . '" class="toc"></ul><script>$(document).ready(function() { let toc_container = $("#' . $toc_id . '").parent().closest("div").attr("id") || ".section-content-wrapper"; $("#' . $toc_id . '").toc({content: "#" + toc_container}); });</script>', $Text, 1);
}
// Check for table of content with params
while(strpos($Text,'[toc') !== false) {