Permalink
Browse files

fix(ckeditor): ensure basepath is set before CKeditor is loaded

This converts `set-basepath.js` to a real module and makes sure it's run
before `ckeditor.js` is loaded. Previously we wrongly assumed ckeditor would
always be loaded after elgg.js ran all `require()` scripts.

Fixes #10304
  • Loading branch information...
mrclay committed Oct 2, 2016
1 parent 9bbbcdb commit d60389d25c033addbb18faf1cd1d0eb43b5b6d7f
Showing with 3 additions and 1 deletion.
  1. +1 −0 mod/ckeditor/start.php
  2. +2 −1 mod/ckeditor/views/default/elgg/ckeditor/set-basepath.js
View
@@ -15,6 +15,7 @@ function ckeditor_init() {
elgg_extend_view('elgg/wysiwyg.css', 'elements/typography.css', 100);
elgg_define_js('ckeditor', array(
'deps' => ['elgg/ckeditor/set-basepath'],
'exports' => 'CKEDITOR',
));
elgg_define_js('jquery.ckeditor', array(
@@ -1,7 +1,8 @@
/**
* This view extends elgg.js and sets ckeditor basepath before jquery.ckeditor is loaded
*/
require(['elgg'], function(elgg) {
define('elgg/ckeditor/set-basepath', function (require) {
var elgg = require('elgg');
// This global variable must be set before the editor script loading.
CKEDITOR_BASEPATH = elgg.get_simplecache_url('ckeditor/');
});

0 comments on commit d60389d

Please sign in to comment.