X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=_source%2Fplugins%2Ffloatpanel%2Fplugin.js;h=178459e2ccd4f9ea78f259253cccce3e9b643012;hb=c9fdde67e6384bd5a66adc2b3bba5c4ce9db56c7;hp=849d5fc6945f453358e815b7acff179813ec72f1;hpb=c6e377a02b54abc07129d72b632763c727476a15;p=ckeditor.git diff --git a/_source/plugins/floatpanel/plugin.js b/_source/plugins/floatpanel/plugin.js index 849d5fc..178459e 100644 --- a/_source/plugins/floatpanel/plugin.js +++ b/_source/plugins/floatpanel/plugin.js @@ -129,14 +129,15 @@ CKEDITOR.plugins.add( 'floatpanel', element.setStyles( { - top : top + 'px', - left : '-3000px', - opacity : '0', // FF3 is ignoring "visibility" + top : '-30000px', display : '' }); + // Don't use display or visibility style because we need to + // calculate the rendering layout later and focus the element. + element.setOpacity( 0 ); // To allow the context menu to decrease back their width - element.getFirst().removeStyle('width'); + element.getFirst().removeStyle( 'width' ); // Configure the IFrame blur event. Do that only once. if ( !this._.blurSet ) @@ -158,10 +159,10 @@ CKEDITOR.plugins.add( 'floatpanel', // the blur event may get fired even when focusing // inside the window itself, so we must ensure the // target is out of it. - var target = ev.data.getTarget(), - targetWindow = target.getWindow && target.getWindow(); - - if ( targetWindow && targetWindow.equals( focused ) ) + var target; + if ( CKEDITOR.env.ie && !this.allowBlur() + || ( target = ev.data.getTarget() ) + && target.getName && target.getName() != 'iframe' ) return; if ( this.visible && !this._.activeChild && !isShowing ) @@ -182,9 +183,10 @@ CKEDITOR.plugins.add( 'floatpanel', this._.blurSet = 1; } - panel.onEscape = CKEDITOR.tools.bind( function() + panel.onEscape = CKEDITOR.tools.bind( function( keystroke ) { - this.onEscape && this.onEscape(); + if ( this.onEscape && this.onEscape( keystroke ) === false ) + return false; }, this ); @@ -202,10 +204,10 @@ CKEDITOR.plugins.add( 'floatpanel', // 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) + if ( CKEDITOR.env.gecko || CKEDITOR.env.opera ) widthNode = widthNode.parentNode; - if ( CKEDITOR.env.ie) + if ( CKEDITOR.env.ie ) widthNode = widthNode.document.body; var width = widthNode.scrollWidth; @@ -258,37 +260,45 @@ 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 ); + } + } + element.setStyles( { top : top + 'px', - left : left + 'px', - opacity : '1' + left : left + 'px' } ); - + element.setOpacity( 1 ); } , this ); panel.isLoaded ? panelLoad() : panel.onLoad = panelLoad; // Set the panel frame focus, so the blur event gets fired. CKEDITOR.tools.setTimeout( function() - { - if ( definition.voiceLabel ) - { - if ( CKEDITOR.env.gecko ) - { - var container = iframe.getParent(); - container.setAttribute( 'role', 'region' ); - container.setAttribute( 'title', definition.voiceLabel ); - iframe.setAttribute( 'role', 'region' ); - iframe.setAttribute( 'title', ' ' ); - } - } - - iframe.$.contentWindow.focus(); - // We need this get fired manually because of unfired focus() function. - this.allowBlur( true ); - - }, 0, this); + { + iframe.$.contentWindow.focus(); + // We need this get fired manually because of unfired focus() function. + this.allowBlur( true ); + }, 0, this); }, 0, this); this.visible = 1;