-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
specialchar plugin overwrites translation data when opening the dialog causing crash if multiple richtext areas are created after opening the first dialog #5485
Comments
It's been a while since we last heard from you. We are marking this issue as stale due to inactivity. Please provide the requested feedback or the issue will be closed after next 7 days. |
Why? I was not asked any additional question |
@nchieffo, I'd like to apologize for the delay in responding. Could you show a simple reproduction of the issue, e.g. on CodePen? It would greatly help with debugging the issue. |
Sorry but I'm not that experienced with ckeditor, I was just using it through a CMS and I don't know how the instantiations are done.
STEP 1
STEP 2
|
@nchieffo, I'm not able to reproduce the issue → https://jsfiddle.net/Comandeer/ofw17b3j/ The demo shows two editor instances with |
Thanks for creating the demo, I'll try to have a look and make it reproducible |
I started to make some changes, and here's where I was able to do, still incomplete : https://jsfiddle.net/b3d0rezy/2/ The key difference that I'm not able to replicate, is that the plugin is not bundled in the JS, and is not initialized in the config object, but it's initialized afterwards by picking an external .js file called specialchar/plugin.js CKEDITOR.plugins.addExternal("specialchar", "/resources/com.coremedia.blueprint__vfcorp-studio-plugin/ckeditor/plugins/specialchar/plugin.js", "") I'm unable to find this file in a public CDN so I can't try to have it in jsfiddle |
I've finally managed to reproduce the issue: https://jsfiddle.net/Comandeer/7rhwq8Ld/ Procedure:
The actual result:
|
@Comandeer thank you very much for your help. Do you think that the solution provided in the 1st post may be valid? |
Yes, it seems so. |
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
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
The text was updated successfully, but these errors were encountered: