[TikiWiki-commits] [Git][tikiwiki/tiki][master] [FIX] Parser: centered headings not visually centered due to flex justify override

"ushindi bienvenu \(@usbbush\) via TikiWiki-cvs" <[email protected]>
Newsgroups gmane.comp.cms.tiki.cvs
Message-ID <6a2fda09363b3_381960404279a@gitlab-sidekiq-low-urgency-cpu-bound-v2-59fd79ccfd-tsgkw.mail>

ushindi bienvenu pushed to branch master at Tiki Wiki CMS Groupware / Tiki


Commits:
1cfc6973 by Olivier Kango at 2026-06-15T10:37:13+00:00
[FIX] Parser: centered headings not visually centered due to flex justify override
---
* [FIX] Parser: centered headings not visually centered due to flex justify override

See merge request tikiwiki/tiki!10527

- - - - -


2 changed files:

- lib/parser/parserlib.php
- lib/test/editlib/ParseToWysiwyg_TextTest.php


Changes:

=====================================
lib/parser/parserlib.php
=====================================
@@ -3021,6 +3021,7 @@ class ParserLib extends TikiDb_Bridge
                         }
 
                         $style = $do_center ? ' style="text-align: center;"' : '';
+                        $justify = $do_center ? 'justify-content-center' : 'justify-content-start';
                         if ($prefs['wiki_heading_links'] !== 'n' && ($prefs['wiki_heading_links'] >= $hdrlevel || $prefs['wiki_heading_links'] === 'y' ) && (! isset($this->option['html_editor']) || ! $this->option['html_editor'])) {
                             $smarty = TikiLib::lib('smarty');
                             $headingLink = '<a href="#' . $thisid . '" class="heading-link" aria-label="heading link">' . smarty_function_icon(['name' => 'link'], $smarty->getEmptyInternalTemplate()) . '</a>';
@@ -3029,9 +3030,9 @@ class ParserLib extends TikiDb_Bridge
                         }
 
                         if ($prefs['feature_wiki_show_hide_before'] == 'y') {
-                            $line = $button . '<h' . ($hdrlevel) . $style . ' class="showhide_heading d-flex justify-content-start" id="' . $thisid . '">' . $aclose . ' ' . $title_text . $headingLink . '</h' . ($hdrlevel) . '>' . $aclose2;
+                            $line = $button . '<h' . ($hdrlevel) . $style . ' class="showhide_heading d-flex ' . $justify . '" id="' . $thisid . '">' . $aclose . ' ' . $title_text . $headingLink . '</h' . ($hdrlevel) . '>' . $aclose2;
                         } else {
-                            $line = $button . '<h' . ($hdrlevel) . $style . ' class="showhide_heading d-flex justify-content-start" id="' . $thisid . '">' . $title_text . $headingLink . '</h' . ($hdrlevel) . '>' . $aclose . $aclose2;
+                            $line = $button . '<h' . ($hdrlevel) . $style . ' class="showhide_heading d-flex ' . $justify . '" id="' . $thisid . '">' . $title_text . $headingLink . '</h' . ($hdrlevel) . '>' . $aclose . $aclose2;
                         }
                     } elseif (! strcmp($line, $prefs['wiki_page_separator'])) {
                         // Close open paragraph, lists, and div's


=====================================
lib/test/editlib/ParseToWysiwyg_TextTest.php
=====================================
@@ -152,13 +152,13 @@ class EditLib_ParseToWysiwyg_TextTest extends TikiTestCase
         $prefs['feature_use_three_colon_centertag'] = 'n';
         $prefs['wiki_heading_links'] = 'n';
         $inData = '!::Heading::';
-        $ex = '<h1 style="text-align: center;" class="showhide_heading d-flex justify-content-start" id="Heading">Heading</h1>';
+        $ex = '<h1 style="text-align: center;" class="showhide_heading d-flex justify-content-center" id="Heading">Heading</h1>';
         $out = trim($this->el->parseToWysiwyg($inData));
         $this->assertEquals($ex, $out);
 
         $prefs['feature_use_three_colon_centertag'] = 'y';
         $inData = '!:::Heading:::';
-        $ex = '<h1 style="text-align: center;" class="showhide_heading d-flex justify-content-start" id="Heading">Heading</h1>';
+        $ex = '<h1 style="text-align: center;" class="showhide_heading d-flex justify-content-center" id="Heading">Heading</h1>';
         $out = trim($this->el->parseToWysiwyg($inData));
         $this->assertEquals($ex, $out);
 
@@ -168,13 +168,13 @@ class EditLib_ParseToWysiwyg_TextTest extends TikiTestCase
          */
         $prefs['feature_use_three_colon_centertag'] = 'n';
         $inData = '!#::Heading::';
-        $ex = '<h1 style="text-align: center;" class="showhide_heading d-flex justify-content-start" id="Heading">1. Heading</h1>';
+        $ex = '<h1 style="text-align: center;" class="showhide_heading d-flex justify-content-center" id="Heading">1. Heading</h1>';
         $out = trim($this->el->parseToWysiwyg($inData));
         $this->assertEquals($ex, $out);
 
         $prefs['feature_use_three_colon_centertag'] = 'y';
         $inData = '!#:::Heading:::';
-        $ex = '<h1 style="text-align: center;" class="showhide_heading d-flex justify-content-start" id="Heading">1. Heading</h1>';
+        $ex = '<h1 style="text-align: center;" class="showhide_heading d-flex justify-content-center" id="Heading">1. Heading</h1>';
         $out = trim($this->el->parseToWysiwyg($inData));
         $this->assertEquals($ex, $out);
     }



View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/1cfc69731b74e05b3f4f9e4906d50a13b2601c35

-- 
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/1cfc69731b74e05b3f4f9e4906d50a13b2601c35
You're receiving this email because of your account on gitlab.com. Manage all notifications: https://gitlab.com/-/profile/notifications | Help: https://gitlab.com/help

_______________________________________________
TikiWiki-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tikiwiki-cvs
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.