JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
vanilla ckeditor-3.4.2
[ckeditor.git] / _source / plugins / floatpanel / plugin.js
index 178459e..8940192 100644 (file)
@@ -16,14 +16,8 @@ CKEDITOR.plugins.add( 'floatpanel',
        function getPanel( editor, doc, parentElement, definition, level )\r
        {\r
                // Generates the panel key: docId-eleId-skinName-langDir[-uiColor][-CSSs][-level]\r
-               var key =\r
-                       doc.getUniqueId() +\r
-                       '-' + parentElement.getUniqueId() +\r
-                       '-' + editor.skinName +\r
-                       '-' + editor.lang.dir +\r
-                       ( ( editor.uiColor && ( '-' + editor.uiColor ) ) || '' ) +\r
-                       ( ( definition.css && ( '-' + definition.css ) ) || '' ) +\r
-                       ( ( level && ( '-' + level ) ) || '' );\r
+               var key = CKEDITOR.tools.genKey( doc.getUniqueId(), parentElement.getUniqueId(), editor.skinName, editor.lang.dir,\r
+                       editor.uiColor || '', definition.css || '', level || '' );\r
 \r
                var panel = panels[ key ];\r
 \r
@@ -46,7 +40,7 @@ CKEDITOR.plugins.add( 'floatpanel',
        {\r
                $ : function( editor, parentElement, definition, level )\r
                {\r
-                       definition.forceIFrame = true;\r
+                       definition.forceIFrame = 1;\r
 \r
                        var doc = parentElement.getDocument(),\r
                                panel = getPanel( editor, doc, parentElement, definition, level || 0 ),\r
@@ -104,7 +98,7 @@ CKEDITOR.plugins.add( 'floatpanel',
                                        block = panel.showBlock( name );\r
 \r
                                this.allowBlur( false );\r
-                               isShowing = true;\r
+                               isShowing = 1;\r
 \r
                                var element = this.element,\r
                                        iframe = this._.iframe,\r
@@ -129,7 +123,8 @@ CKEDITOR.plugins.add( 'floatpanel',
 \r
                                element.setStyles(\r
                                        {\r
-                                               top : '-30000px',\r
+                                               top : 0,\r
+                                               left: 0,\r
                                                display : ''\r
                                        });\r
                                // Don't use display or visibility style because we need to\r
@@ -282,6 +277,14 @@ CKEDITOR.plugins.add( 'floatpanel',
                                                                }\r
                                                        }\r
 \r
+                                                       // Trigger the onHide event of the previously active panel to prevent\r
+                                                       // incorrect styles from being applied (#6170)\r
+                                                       var innerElement = element.getFirst(),\r
+                                                               activePanel;\r
+                                                       if ( ( activePanel = innerElement.getCustomData( 'activePanel' ) ) )\r
+                                                               activePanel.onHide && activePanel.onHide.call( this, 1 );\r
+                                                       innerElement.setCustomData( 'activePanel', this );\r
+\r
                                                        element.setStyles(\r
                                                                {\r
                                                                        top : top + 'px',\r
@@ -305,7 +308,7 @@ CKEDITOR.plugins.add( 'floatpanel',
                                if ( this.onShow )\r
                                        this.onShow.call( this );\r
 \r
-                               isShowing = false;\r
+                               isShowing = 0;\r
                        },\r
 \r
                        hide : function()\r
@@ -315,6 +318,7 @@ CKEDITOR.plugins.add( 'floatpanel',
                                        this.hideChild();\r
                                        this.element.setStyle( 'display', 'none' );\r
                                        this.visible = 0;\r
+                                       this.element.getFirst().removeCustomData( 'activePanel' );\r
                                }\r
                        },\r
 \r