javascriptckeditorsideloading

Multiple versions of ckeditor on same page


Is there a way for multiple versions of ckeditor library to exist on the same page without conflicting with the other version? The way jquery as jquery.noConflict mode?

The use case is that there are different teams in our organization building different widgets and 2 of them are using some forked and customized ckeditors and both are of different release versions. Currently, things are broken when they conflict on the same page.

Anyone faced similar issue and tried to solve this before?


Solution

  • There is no such feature in CKEditor. CKEditor register global variable CKEDITOR, that's why loading another version will not work. Hiding global variable under some kind of closure might be tricky and for sure will require a lot of work with it. There is bunch of different things which are loaded with CKEditor (like some custom styles, or not minified libs). So you should somehow take care about it too.

    You should be able to load different versions in separate iframes, this will provide you separate environment, where different versions will work separately.

    Another more convenient option would be to prepare only one version which will work for everybody, and just provide different configs for every instance which should differ. This will load library only once on your page. For example you might remove some plugins by using config.removePlugins. There is also plenty of other things you can customise for every single editor instance.