-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Description
Type of report
Bug
Provide detailed reproduction steps (if any)
When the user runs the specialchar command, the code executes a call to a function that loads a 2nd localization file in dialogs/lang/ folder.
That file contains a script that executes this function
CKEDITOR.plugins.setLang( 'specialchar', 'en', {
Expected result
The code that is executed in the translation file DOES NOT overwrite the plugin translation data that is stored in CKEDITOR.plugins.registered.specialchar.langEntries
Actual result
The code that is executed in the translation file overwrite the plugin translation data that is stored in CKEDITOR.plugins.registered.specialchar.langEntries
Other details
Normally when using 1 single CKEditor window, the problem is not visible, as the translations are actually extended in the local editor variable, as part of the script load callback.
CKEDITOR.tools.extend( editor.lang.specialchar, plugin.langEntries[ langCode ] );
But at this point the shared translations have been overwritten with the new localization loaded
In the software that I'm using (Coremedia CMS with ckeditor 4.19), multiple CKEditor windows can coexist, and the CKEDITOR variable is shared.
When opening a CMS content with a richtext editor for the first time, and opening the specialchar dialog, everything is fine.
But when opening a second CMS content with a richtext editor, a the CKEDITOR variable is re-used, the plugin is not re-loaded as it's already loaded but it contains the wrong translations, so when the dialog is being created, the lang.title variable is null, causing the plugin to crash.
in specialchar.js
return {
title: lang.title,
CKEDITOR crashes because of undefined title variable in the dialog
I have found a way to fix it, by adding an additional invocation in plugin.js
CKEDITOR.scriptLoader.load( CKEDITOR.getUrl( plugin.path + 'dialogs/lang/' + langCode + '.js' ), function() {
CKEDITOR.tools.extend( editor.lang.specialchar, plugin.langEntries[ langCode ] );
CKEDITOR.plugins.setLang( 'specialchar', langCode, editor.lang.specialchar); // this is the line I added
editor.openDialog( pluginName );
} );