X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=_source%2Fplugins%2Ffloatpanel%2Fplugin.js;h=8dc7ae2010f206174423bdf53228364c61ffa217;hb=614511639979907ceb0da3614122a4d8eb963ad4;hp=178459e2ccd4f9ea78f259253cccce3e9b643012;hpb=c9fdde67e6384bd5a66adc2b3bba5c4ce9db56c7;p=ckeditor.git diff --git a/_source/plugins/floatpanel/plugin.js b/_source/plugins/floatpanel/plugin.js index 178459e..8dc7ae2 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 ), @@ -66,6 +60,8 @@ CKEDITOR.plugins.add( 'floatpanel', children : [], dir : editor.lang.dir }; + + editor.on( 'mode', function(){ this.hide(); }, this ); }, proto : @@ -104,7 +100,7 @@ CKEDITOR.plugins.add( 'floatpanel', block = panel.showBlock( name ); this.allowBlur( false ); - isShowing = true; + isShowing = 1; var element = this.element, iframe = this._.iframe, @@ -129,9 +125,11 @@ CKEDITOR.plugins.add( 'floatpanel', element.setStyles( { - top : '-30000px', + top : top + 'px', + left: 0, display : '' }); + // Don't use display or visibility style because we need to // calculate the rendering layout later and focus the element. element.setOpacity( 0 ); @@ -282,6 +280,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 +311,7 @@ CKEDITOR.plugins.add( 'floatpanel', if ( this.onShow ) this.onShow.call( this ); - isShowing = false; + isShowing = 0; }, hide : function() @@ -315,6 +321,7 @@ CKEDITOR.plugins.add( 'floatpanel', this.hideChild(); this.element.setStyle( 'display', 'none' ); this.visible = 0; + this.element.getFirst().removeCustomData( 'activePanel' ); } },