Opened 15 years ago
Closed 15 years ago
#5012 closed Bug (fixed)
If the menu plugin isn't initialized compressed CKEditor fails to load
Reported by: | Alfonso Martínez de Lizarrondo | Owned by: | Frederico Caldeira Knabben |
---|---|---|---|
Priority: | Normal | Milestone: | CKEditor 3.2 |
Component: | UI : Context Menu | Version: | 3.1 |
Keywords: | Review+ | Cc: |
Description
From http://cksource.com/forums/viewtopic.php?f=11&t=17216
In the config.js of the release version set this to remove the custom context menu
config.removePlugins = 'scayt,menubutton,contextmenu';
Now when the page is reloaded the editor fails to initialize "'this._.menuGroups' is null or not an object"
The problem is really in the menu plugin.js that always executes some code even if it hasn't been initialized.
Attachments (2)
Change History (6)
Changed 15 years ago by
Attachment: | 5012.patch added |
---|
comment:1 Changed 15 years ago by
Keywords: | Review- added; Review? removed |
---|---|
Owner: | changed from Alfonso Martínez de Lizarrondo to Frederico Caldeira Knabben |
Status: | new → assigned |
Looking at the menu plugin, we can just see that it's expanding the CKEDITOR.editor.prototype with new methods, so it's not actually executing anything in special.
Our problem here is that we have other parts of the code using one of these methods to "sniff" the API to understand whether to use it or not. In these cases we have problems as the menu privates have not been initialized.
The proposed fix makes it work, but it has a few issues:
- If we have several editor instanced in the page, it unnecessary attempts to extend the CKEDITOR.editor.prototype for each of them, even if it needs to be done just for the first one (as the original code does).
- It doesn't solve the problem totally. In fact, if we have several instances and only one of them doesn't load the menu plugin, then we may still not have the private initialized for it, but the prototype could still be extended by other instances.
I'll come with a different proposal to fix it.
Changed 15 years ago by
Attachment: | 5012_2.patch added |
---|
comment:2 Changed 15 years ago by
Keywords: | Review? added; Review- removed |
---|
The proposed path avoids extending CKEDITOR.editor.prototype, extending instead only the instances that have the menu plugin enabled.
comment:3 Changed 15 years ago by
Keywords: | Review+ added; Review? removed |
---|
Yes, I didn't thought about the multiple editors situation.
Proposed patch. Just a little reordering of the code