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

"Olivier Kango \(@olivierkango\) via TikiWiki-cvs" <[email protected]>
Newsgroups gmane.comp.cms.tiki.cvs
Message-ID <6a339009b91ec_384ea53452714@gitlab-sidekiq-low-urgency-cpu-bound-v2-7564678668-d46zp.mail>

Olivier Kango pushed to branch 30.x at Tiki Wiki CMS Groupware / Tiki


Commits:
a49d229c by Olivier Kango at 2026-06-18T09:21:42+03:00
[BP][FIX] Parser: centered headings not visually centered due to flex justify override
---
* [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

(cherry picked from commit 1cfc69731b74e05b3f4f9e4906d50a13b2601c35)

See merge request tikiwiki/tiki!10549

- - - - -


2 changed files:

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


Changes:

=====================================
lib/parser/parserlib.php
=====================================
@@ -2970,6 +2970,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>';
@@ -2978,9 +2979,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/a49d229c199f073a582821a1b6b51d4ef86a63e1

-- 
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/a49d229c199f073a582821a1b6b51d4ef86a63e1
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.