X-Git-Url: https://jasonwoof.com/gitweb/?p=ckeditor.git;a=blobdiff_plain;f=_source%2Fplugins%2Ffloatpanel%2Fplugin.js;h=8940192d46e197deaad9d2cd665b3444139e7086;hp=178459e2ccd4f9ea78f259253cccce3e9b643012;hb=039a051ccf3901311661022a30afd60fc38130c9;hpb=c9fdde67e6384bd5a66adc2b3bba5c4ce9db56c7 diff --git a/_source/plugins/floatpanel/plugin.js b/_source/plugins/floatpanel/plugin.js index 178459e..8940192 100644 --- a/_source/plugins/floatpanel/plugin.js +++ b/_source/plugins/floatpanel/plugin.js @@ -16,14 +16,8 @@ CKEDITOR.plugins.add( 'floatpanel', function getPanel( editor, doc, parentElement, definition, level ) { // Generates the panel key: docId-eleId-skinName-langDir[-uiColor][-CSSs][-level] - var key = - doc.getUniqueId() + - '-' + parentElement.getUniqueId() + - '-' + editor.skinName + - '-' + editor.lang.dir + - ( ( editor.uiColor && ( '-' + editor.uiColor ) ) || '' ) + - ( ( definition.css && ( '-' + definition.css ) ) || '' ) + - ( ( level && ( '-' + level ) ) || '' ); + var key = CKEDITOR.tools.genKey( doc.getUniqueId(), parentElement.getUniqueId(), editor.skinName, editor.lang.dir, + editor.uiColor || '', definition.css || '', level || '' ); var panel = panels[ key ]; @@ -46,7 +40,7 @@ CKEDITOR.plugins.add( 'floatpanel', { $ : function( editor, parentElement, definition, level ) { - definition.forceIFrame = true; + definition.forceIFrame = 1; var doc = parentElement.getDocument(), panel = getPanel( editor, doc, parentElement, definition, level || 0 ), @@ -104,7 +98,7 @@ CKEDITOR.plugins.add( 'floatpanel', block = panel.showBlock( name ); this.allowBlur( false ); - isShowing = true; + isShowing = 1; var element = this.element, iframe = this._.iframe, @@ -129,7 +123,8 @@ CKEDITOR.plugins.add( 'floatpanel', element.setStyles( { - top : '-30000px', + top : 0, + left: 0, display : '' }); // Don't use display or visibility style because we need to @@ -282,6 +277,14 @@ CKEDITOR.plugins.add( 'floatpanel', } } + // Trigger the onHide event of the previously active panel to prevent + // incorrect styles from being applied (#6170) + var innerElement = element.getFirst(), + activePanel; + if ( ( activePanel = innerElement.getCustomData( 'activePanel' ) ) ) + activePanel.onHide && activePanel.onHide.call( this, 1 ); + innerElement.setCustomData( 'activePanel', this ); + element.setStyles( { top : top + 'px', @@ -305,7 +308,7 @@ CKEDITOR.plugins.add( 'floatpanel', if ( this.onShow ) this.onShow.call( this ); - isShowing = false; + isShowing = 0; }, hide : function() @@ -315,6 +318,7 @@ CKEDITOR.plugins.add( 'floatpanel', this.hideChild(); this.element.setStyle( 'display', 'none' ); this.visible = 0; + this.element.getFirst().removeCustomData( 'activePanel' ); } },