X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=_source%2Fplugins%2Ffloatpanel%2Fplugin.js;h=505ecbd77ef0d952b19ce23f0c370bfc6f14da1c;hb=9afde8772159bd3436f1f5b7862960307710ae5a;hp=05772223c46c5a835ca21db4992d0dd25d787cd9;hpb=055b6b0792ce7dc53d47af606b367c04b927c2ab;p=ckeditor.git diff --git a/_source/plugins/floatpanel/plugin.js b/_source/plugins/floatpanel/plugin.js index 0577222..505ecbd 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 ); @@ -260,6 +258,36 @@ CKEDITOR.plugins.add( 'floatpanel', if ( top + panelSize.height > viewportSize.height + windowScroll.y ) top -= panelSize.height; + // If IE is in RTL, we have troubles with absolute + // position and horizontal scrolls. Here we have a + // series of hacks to workaround it. (#6146) + if ( CKEDITOR.env.ie ) + { + var offsetParent = new CKEDITOR.dom.element( element.$.offsetParent ), + scrollParent = offsetParent; + + // Quirks returns , but standards returns . + if ( scrollParent.getName() == 'html' ) + scrollParent = scrollParent.getDocument().getBody(); + + if ( scrollParent.getComputedStyle( 'direction' ) == 'rtl' ) + { + // For IE8, there is not much logic on this, but it works. + if ( CKEDITOR.env.ie8Compat ) + left -= element.getDocument().getDocumentElement().$.scrollLeft * 2; + else + left -= ( offsetParent.$.scrollWidth - offsetParent.$.clientWidth ); + } + } + + // 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', @@ -277,13 +305,13 @@ CKEDITOR.plugins.add( 'floatpanel', // We need this get fired manually because of unfired focus() function. this.allowBlur( true ); }, 0, this); - }, 0, this); + }, CKEDITOR.env.air ? 200 : 0, this); this.visible = 1; if ( this.onShow ) this.onShow.call( this ); - isShowing = false; + isShowing = 0; }, hide : function() @@ -293,6 +321,7 @@ CKEDITOR.plugins.add( 'floatpanel', this.hideChild(); this.element.setStyle( 'display', 'none' ); this.visible = 0; + this.element.getFirst().removeCustomData( 'activePanel' ); } },