mirror of
https://framagit.org/hubzilla/core.git
synced 2026-06-21 00:52:33 -04:00
make toc bbcode find its own container by default
This commit is contained in:
@@ -1400,7 +1400,7 @@ function bbcode($Text, $options = []) {
|
|||||||
// Check for table of content without params
|
// Check for table of content without params
|
||||||
while(strpos($Text,'[toc]') !== false) {
|
while(strpos($Text,'[toc]') !== false) {
|
||||||
$toc_id = 'toc-' . random_string(10);
|
$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
|
// Check for table of content with params
|
||||||
while(strpos($Text,'[toc') !== false) {
|
while(strpos($Text,'[toc') !== false) {
|
||||||
|
|||||||
Reference in New Issue
Block a user