X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=_source%2Fplugins%2Ffloatpanel%2Fplugin.js;fp=_source%2Fplugins%2Ffloatpanel%2Fplugin.js;h=849d5fc6945f453358e815b7acff179813ec72f1;hb=c6e377a02b54abc07129d72b632763c727476a15;hp=79c5197d1c8658ac5d07592175cb9671e474e881;hpb=941b0a9ba4e673e292510d80a5a86806994b8ea6;p=ckeditor.git diff --git a/_source/plugins/floatpanel/plugin.js b/_source/plugins/floatpanel/plugin.js index 79c5197..849d5fc 100644 --- a/_source/plugins/floatpanel/plugin.js +++ b/_source/plugins/floatpanel/plugin.js @@ -135,6 +135,9 @@ CKEDITOR.plugins.add( 'floatpanel', display : '' }); + // To allow the context menu to decrease back their width + element.getFirst().removeStyle('width'); + // Configure the IFrame blur event. Do that only once. if ( !this._.blurSet ) { @@ -192,9 +195,34 @@ CKEDITOR.plugins.add( 'floatpanel', var panelLoad = CKEDITOR.tools.bind( function () { + var target = element.getFirst(); + if ( block.autoSize ) { - var target = element.getFirst(); + // We must adjust first the width or IE6 could include extra lines in the height computation + var widthNode = block.element.$; + + if ( CKEDITOR.env.gecko || CKEDITOR.env.opera) + widthNode = widthNode.parentNode; + + if ( CKEDITOR.env.ie) + widthNode = widthNode.document.body; + + var width = widthNode.scrollWidth; + // Account for extra height needed due to IE quirks box model bug: + // http://en.wikipedia.org/wiki/Internet_Explorer_box_model_bug + // (#3426) + if ( CKEDITOR.env.ie && CKEDITOR.env.quirks && width > 0 ) + width += ( target.$.offsetWidth || 0 ) - ( target.$.clientWidth || 0 ); + // A little extra at the end. + // If not present, IE6 might break into the next line, but also it looks better this way + width += 4 ; + + target.setStyle( 'width', width + 'px' ); + + // IE doesn't compute the scrollWidth if a filter is applied previously + block.element.addClass( 'cke_frameLoaded' ); + var height = block.element.$.scrollHeight; // Account for extra height needed due to IE quirks box model bug: @@ -209,7 +237,7 @@ CKEDITOR.plugins.add( 'floatpanel', panel._.currentBlock.element.setStyle( 'display', 'none' ).removeStyle( 'display' ); } else - element.getFirst().removeStyle( 'height' ); + target.removeStyle( 'height' ); var panelElement = panel.element, panelWindow = panelElement.getWindow(), @@ -227,7 +255,7 @@ CKEDITOR.plugins.add( 'floatpanel', left += ( panelSize.width * ( rtl ? 1 : -1 ) ); // Vertical off screen is simpler. - if( top + panelSize.height > viewportSize.height + windowScroll.y ) + if ( top + panelSize.height > viewportSize.height + windowScroll.y ) top -= panelSize.height; element.setStyles( @@ -343,11 +371,11 @@ CKEDITOR.plugins.add( 'floatpanel', { var isLastInstance = CKEDITOR.tools.isEmpty( CKEDITOR.instances ); - for( var i in panels ) + for ( var i in panels ) { var panel = panels[ i ]; // Safe to destroy it since there're no more instances.(#4241) - if( isLastInstance ) + if ( isLastInstance ) panel.destroy(); // Panel might be used by other instances, just hide them.(#4552) else