Skip to content

Commit

Permalink
Back to solution with wrapper - there are limitations in events impl.…
Browse files Browse the repository at this point in the history
… that doesn't allow to attach one fn more than once on the same object for the same event.
  • Loading branch information
Reinmar committed Dec 14, 2012
1 parent 0c752cd commit ad8f05e
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions plugins/floatpanel/plugin.js
Expand Up @@ -58,7 +58,8 @@ CKEDITOR.plugins.add( 'floatpanel', {
var doc = parentElement.getDocument(),
panel = getPanel( editor, doc, parentElement, definition, level || 0 ),
element = panel.element,
iframe = element.getFirst();
iframe = element.getFirst(),
that = this;

// Disable native browser menu. (#4825)
element.disableContextMenu();
Expand All @@ -77,10 +78,17 @@ CKEDITOR.plugins.add( 'floatpanel', {
dir: editor.lang.dir
};

editor.on( 'mode', this.hide, this );
editor.on( 'resize', this.hide, this );
editor.on( 'mode', hide );
editor.on( 'resize', hide );
// Window resize doesn't cause hide on blur. (#9800)
doc.getWindow().on( 'resize', this.hide, this );
doc.getWindow().on( 'resize', hide );

// We need a wrapper because events implementation doesn't allow to attach
// one listener more than once for the same event on the same object.
// Remember that floatPanel#hide is shared between all instances.
function hide() {
that.hide();
}
},

proto: {
Expand Down

0 comments on commit ad8f05e

Please sign in to comment.