From ad8f05e36f9211f2b9595e3c9306d8c9e97a5b92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotrek=20Reinmar=20Koszuli=C5=84ski?= Date: Thu, 13 Dec 2012 17:10:31 +0100 Subject: [PATCH] Back to solution with wrapper - there are limitations in events impl. that doesn't allow to attach one fn more than once on the same object for the same event. --- plugins/floatpanel/plugin.js | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/plugins/floatpanel/plugin.js b/plugins/floatpanel/plugin.js index 6b2d24d1f18..e3542849349 100644 --- a/plugins/floatpanel/plugin.js +++ b/plugins/floatpanel/plugin.js @@ -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(); @@ -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: {