Optimization: remove CKeditor lib from homepage - refs CT#8233

1.10.x
Yannick Warnier 9 years ago
parent b0da587cd4
commit cbca687440
  1. 2
      index.php
  2. 7
      main/inc/global.inc.php
  3. 8
      main/inc/lib/template.lib.php
  4. 2
      main/template/default/layout/header.js.tpl

@ -7,6 +7,8 @@
use \ChamiloSession as Session;
define('CHAMILO_HOMEPAGE', true);
// Avoid loading CKeditor lib on homepage (very heavy lib)
define('CHAMILO_LOAD_WYSIWYG', false);
/* Flag forcing the 'current course' reset, as we're not inside a course anymore. */
// Maybe we should change this into an api function? an example: CourseManager::unset();

@ -24,6 +24,13 @@
// Showing/hiding error codes in global error messages.
define('SHOW_ERROR_CODES', false);
// Make sure the CHAMILO_LOAD_WYSIWYG constant is defined
// To remove CKeditor libs from HTML, set this constant to true before loading
// global.inc.php
if (!defined('CHAMILO_LOAD_WYSIWYG')) {
define('CHAMILO_LOAD_WYSIWYG', true);
}
require_once __DIR__.'/../../app/AppKernel.php';
$kernel = new AppKernel();

@ -670,7 +670,6 @@ class Template
'bootstrap/dist/js/bootstrap.min.js',
'jquery-ui/jquery-ui.min.js',
'moment/min/moment-with-locales.min.js',
api_is_anonymous() ? '' : 'ckeditor/ckeditor.js',
'bootstrap-daterangepicker/daterangepicker.js',
'jquery-timeago/jquery.timeago.js',
'mediaelement/build/mediaelement-and-player.min.js',
@ -678,6 +677,9 @@ class Template
'image-map-resizer/js/imageMapResizer.min.js',
'jquery.scrollbar/jquery.scrollbar.min.js'
];
if (CHAMILO_LOAD_WYSIWYG == true) {
$bowerJsFiles[] = 'ckeditor/ckeditor.js';
}
if (api_get_setting('include_asciimathml_script') == 'true') {
$bowerJsFiles[] = 'MathJax/MathJax.js?config=AM_HTMLorMML';
@ -689,9 +691,7 @@ class Template
}
foreach ($bowerJsFiles as $file) {
if (!empty($file)) {
$js_file_to_string .= '<script type="text/javascript" src="'.api_get_path(WEB_PATH).'web/assets/'.$file.'"></script>'."\n";
}
$js_file_to_string .= '<script type="text/javascript" src="'.api_get_path(WEB_PATH).'web/assets/'.$file.'"></script>'."\n";
}
foreach ($js_files as $file) {

@ -1,5 +1,5 @@
<script>
{% if _u.logged %}
{% if constant('CHAMILO_LOAD_WYSIWYG') %}
// External plugins not part of the default Ckeditor package.
var plugins = [
'asciimath',

Loading…
Cancel
Save