Opened 14 years ago

Closed 14 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)

5012.patch (1.6 KB) - added by Alfonso Martínez de Lizarrondo 14 years ago.
Proposed patch. Just a little reordering of the code
5012_2.patch (1.8 KB) - added by Frederico Caldeira Knabben 14 years ago.

Download all attachments as: .zip

Change History (6)

Changed 14 years ago by Alfonso Martínez de Lizarrondo

Attachment: 5012.patch added

Proposed patch. Just a little reordering of the code

comment:1 Changed 14 years ago by Frederico Caldeira Knabben

Keywords: Review- added; Review? removed
Owner: changed from Alfonso Martínez de Lizarrondo to Frederico Caldeira Knabben
Status: newassigned

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 14 years ago by Frederico Caldeira Knabben

Attachment: 5012_2.patch added

comment:2 Changed 14 years ago by Frederico Caldeira Knabben

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 14 years ago by Alfonso Martínez de Lizarrondo

Keywords: Review+ added; Review? removed

Yes, I didn't thought about the multiple editors situation.

comment:4 Changed 14 years ago by Frederico Caldeira Knabben

Resolution: fixed
Status: assignedclosed

Fixed with [4971].

Note: See TracTickets for help on using tickets.
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy