[TikiWiki-commits] [Git][tikiwiki/tiki][master] [FIX] Load CodeMirror CSS early to prevent broken editor in Ajax/Smarty context

"luci \(@luciash\) via TikiWiki-cvs" <[email protected]>
Newsgroups gmane.comp.cms.tiki.cvs
Message-ID <69f0b9742bee3_3819030c1088@gitlab-sidekiq-low-urgency-cpu-bound-v2-584f6cb8d4-gmncd.mail>

luci pushed to branch master at Tiki Wiki CMS Groupware / Tiki


Commits:
a928d50e by ushindi bienvenu at 2026-04-28T13:35:21+00:00
[FIX] Load CodeMirror CSS early to prevent broken editor in Ajax/Smarty context
---
* [FIX] Load CodeMirror CSS early to prevent broken editor in Ajax/Smarty context

See merge request tikiwiki/tiki!10093

- - - - -


2 changed files:

- lib/codemirror_tiki/tiki_codemirror.php
- tiki-setup.php


Changes:

=====================================
lib/codemirror_tiki/tiki_codemirror.php
=====================================
@@ -62,12 +62,11 @@ test = { mode: function () {}, indentation: function() {} }
     }
 
     //add codemirror stuff
-    TikiLib::lib("header")->add_cssfile(CODEMIRROR_DIST_PATH . '/lib/codemirror.css')
+    TikiLib::lib("header")
         ->add_jsfile_dependency(CODEMIRROR_DIST_PATH . '/lib/codemirror.js')
         ->add_jsfile(CODEMIRROR_DIST_PATH . '/addon/search/searchcursor.js')
         ->add_jsfile(CODEMIRROR_DIST_PATH . '/addon/mode/overlay.js')
         //add tiki stuff
-        ->add_cssfile('themes/base_files/feature_css/codemirror_tiki.css')
         ->add_jsfile('lib/codemirror_tiki/codemirror_tiki.js')
         //add interactjs
         ->add_jsfile(NODE_PUBLIC_DIST_PATH . '/interactjs/dist/interact.min.js')


=====================================
tiki-setup.php
=====================================
@@ -638,7 +638,14 @@ if ($prefs['feature_jquery_zoom'] === 'y') {
 }
 ');
 }
-
+// Load CodeMirror CSS early.
+// Adding it from Smarty/Ajax is too late and breaks the editor.
+// Therefore, we load these CSS files during setup (tiki-setup.php / early stage)
+// to ensure they are present in the <head> before any rendering occurs.
+if ($prefs['feature_syntax_highlighter'] == 'y') {
+    $headerlib->add_cssfile(CODEMIRROR_DIST_PATH . '/lib/codemirror.css')
+        ->add_cssfile('themes/base_files/feature_css/codemirror_tiki.css');
+}
 if ($prefs['feature_ajax'] === 'y') {
     $headerlib->add_jsfile('lib/jquery_tiki/tiki-confirm.js');
     $headerlib->add_jsfile('lib/ajax/autosave.js'); // Note that this file is needed even if ajax_autosave is off otherwise wysiwyg won't load.



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

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