Opened 7 years ago

Closed 7 years ago

#5012 closed Bug (fixed)

If the menu plugin isn't initialized compressed CKEditor fails to load

Reported by: alfonsoml Owned by: fredck
Priority: Normal Milestone: CKEditor 3.2
Component: UI : Context Menu Version: 3.1
Keywords: Review+ Cc:



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 alfonsoml 7 years ago.
Proposed patch. Just a little reordering of the code
5012_2.patch (1.8 KB) - added by fredck 7 years ago.

Download all attachments as: .zip

Change History (6)

Changed 7 years ago by alfonsoml

Proposed patch. Just a little reordering of the code

comment:1 Changed 7 years ago by fredck

  • Keywords Review- added; Review? removed
  • Owner changed from alfonsoml to fredck
  • Status changed from new to 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 7 years ago by fredck

comment:2 Changed 7 years ago by fredck

  • 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 7 years ago by alfonsoml

  • Keywords Review+ added; Review? removed

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

comment:4 Changed 7 years ago by fredck

  • Resolution set to fixed
  • Status changed from assigned to closed

Fixed with [4971].

Note: See TracTickets for help on using tickets.
© 2003 – 2017 CKSource – Frederico Knabben. All rights reserved. | Terms of use | Privacy policy