Reputation: 762
I am getting Uncaught TypeError: Cannot set property 'dir' of undefined when i try to load ckeditor. I am using requireJs to load Js and it's dependency and also using gulp to minify.
My requireJs config file:
requirejs.config({
baseUrl:"/js",
paths: {
"jquery": "vendors/jquery",
"ckeditorFull":"vendors/ckeditor/ckeditor"
},
shim: {
"ckeditorFull":{
deps:['jquery']
}
}
});
require(["app"],function(App){
App.init();
});
I am using Ckeditor verison 4.9.2 full edition.I have added basepath before initialising the ckeditor.
define([
"jquery","ckeditorFull"
],function($){
var ckeditorFull = function()
{
try{
window.CKEDITOR_BASEPATH = '../vendors/ckeditor/';
CKEDITOR.replace( 'summary-ckeditor',{
language: 'en'
});
}
catch(err) {
}
};
var init = function(){
ckeditorFull();
};
return {
init:init,
}
});
Then i trying to run the app i getting following error on my console.
Uncaught TypeError: Cannot set property 'dir' of undefined
at Object.d (app.min.js:24250)
at e (app.min.js:24251)
at Array.z (app.min.js:24251)
at y (app.min.js:24251)
at HTMLScriptElement.A.CKEDITOR.env.ie.e.$.onerror
I tried all possible ways but still can't resolve it.Please let me favour thank you!
Upvotes: 3
Views: 3674
Reputation: 2163
For others with this problem (since it still persists as of the newest version at this time), if you have self-hosted the CKEditor script in your solution (for example for a classic ASP.NET application) and you do not have all the localization files of the plugin in your CKEditor folder, that can cause this issue to happen.
We for example only had the en.js
file in our /CKEditor/lang/
folder, and the bug occurred when a user that had both english and danish as his browser languages. CKEditor tried to automatically set the language of the editor to Danish, and tried to load the /CKEditor/lang/da.js
file, which did not exist (which caused a 404 error). Adding the following to the config.js file fixed the problem for us:
config.language = 'en';
setting config.language ensures that the language of the editor is set to english instead of it being auto detected.
Upvotes: 3