X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=_source%2Fplugins%2Fmaximize%2Fplugin.js;h=abefd1d31c5bcd4aac8c305e5dd37c40b22c0953;hb=4e90e78dc97789709ee7404359a5517540c27553;hp=bcb726c8d5c60f2a6c868100a98cc93cb7e8124e;hpb=f8fc585c18d287eb325c575596d183122486b641;p=ckeditor.git diff --git a/_source/plugins/maximize/plugin.js b/_source/plugins/maximize/plugin.js index bcb726c..abefd1d 100644 --- a/_source/plugins/maximize/plugin.js +++ b/_source/plugins/maximize/plugin.js @@ -1,5 +1,5 @@ /* -Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved. +Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ @@ -10,8 +10,8 @@ For licensing, see LICENSE.html or http://ckeditor.com/license if ( !formElement || formElement.type != CKEDITOR.NODE_ELEMENT || formElement.getName() != 'form' ) return []; - var hijackRecord = []; - var hijackNames = [ 'style', 'className' ]; + var hijackRecord = [], + hijackNames = [ 'style', 'className' ]; for ( var i = 0 ; i < hijackNames.length ; i++ ) { var name = hijackNames[i]; @@ -129,12 +129,12 @@ For licensing, see LICENSE.html or http://ckeditor.com/license init : function( editor ) { var lang = editor.lang; - var mainDocument = CKEDITOR.document; - var mainWindow = mainDocument.getWindow(); + var mainDocument = CKEDITOR.document, + mainWindow = mainDocument.getWindow(); // Saved selection and scroll position for the editing area. - var savedSelection; - var savedScroll; + var savedSelection, + savedScroll; // Saved scroll position for the outer window. var outerScroll; @@ -194,20 +194,16 @@ For licensing, see LICENSE.html or http://ckeditor.com/license container.setCustomData( 'maximize_saved_styles', saveStyles( container, true ) ); // Hide scroll bars. - if ( CKEDITOR.env.ie ) - { - mainDocument.$.documentElement.style.overflow = - mainDocument.getBody().$.style.overflow = 'hidden'; - } - else - { - mainDocument.getBody().setStyles( - { - overflow : 'hidden', - width : '0px', - height : '0px' - } ); - } + var styles = + { + overflow : CKEDITOR.env.webkit ? '' : 'hidden', // #6896 + width : 0, + height : 0 + }; + + mainDocument.getDocumentElement().setStyles( styles ); + !CKEDITOR.env.gecko && mainDocument.getDocumentElement().setStyle( 'position', 'fixed' ); + !( CKEDITOR.env.gecko && CKEDITOR.env.quirks ) && mainDocument.getBody().setStyles( styles ); // Scroll to the top left (IE needs some time for it - #4923). CKEDITOR.env.ie ? @@ -215,8 +211,8 @@ For licensing, see LICENSE.html or http://ckeditor.com/license mainWindow.$.scrollTo( 0, 0 ); // Resize and move to top left. - var viewPaneSize = mainWindow.getViewPaneSize(); - container.setStyle( 'position', 'absolute' ); + // Special treatment for FF Quirks (#7284) + container.setStyle( 'position', CKEDITOR.env.gecko && CKEDITOR.env.quirks ? 'fixed' : 'absolute' ); container.$.offsetLeft; // SAFARI BUG: See #2066. container.setStyles( { @@ -226,6 +222,10 @@ For licensing, see LICENSE.html or http://ckeditor.com/license } ); shim = createIframeShim( container ); // IE6 select element penetration when maximized. (#4459) + + // Add cke_maximized class before resize handle since that will change things sizes (#5580) + container.addClass( 'cke_maximized' ); + resizeHandler(); // Still not top left? Fix it. (Bug #174) @@ -239,8 +239,6 @@ For licensing, see LICENSE.html or http://ckeditor.com/license // Fixing positioning editor chrome in Firefox break design mode. (#5149) CKEDITOR.env.gecko && refreshCursor( editor ); - // Add cke_maximized class. - container.addClass( 'cke_maximized' ); } else if ( this.state == CKEDITOR.TRISTATE_ON ) // Restore from fullscreen if the state is on. { @@ -270,6 +268,13 @@ For licensing, see LICENSE.html or http://ckeditor.com/license // Remove cke_maximized class. container.removeClass( 'cke_maximized' ); + // Webkit requires a re-layout on editor chrome. (#6695) + if ( CKEDITOR.env.webkit ) + { + container.setStyle( 'display', 'inline' ); + setTimeout( function(){ container.setStyle( 'display', 'block' ); }, 0 ); + } + if ( shim ) { shim.remove(); @@ -285,12 +290,16 @@ For licensing, see LICENSE.html or http://ckeditor.com/license // Toggle button label. var button = this.uiItems[ 0 ]; - var label = ( this.state == CKEDITOR.TRISTATE_OFF ) - ? lang.maximize : lang.minimize; - var buttonNode = editor.element.getDocument().getById( button._.id ); - buttonNode.getChild( 1 ).setHtml( label ); - buttonNode.setAttribute( 'title', label ); - buttonNode.setAttribute( 'href', 'javascript:void("' + label + '");' ); + // Only try to change the button if it exists (#6166) + if( button ) + { + var label = ( this.state == CKEDITOR.TRISTATE_OFF ) + ? lang.maximize : lang.minimize; + var buttonNode = editor.element.getDocument().getById( button._.id ); + buttonNode.getChild( 1 ).setHtml( label ); + buttonNode.setAttribute( 'title', label ); + buttonNode.setAttribute( 'href', 'javascript:void("' + label + '");' ); + } // Restore selection and scroll position in editing area. if ( editor.mode == 'wysiwyg' ) @@ -331,10 +340,11 @@ For licensing, see LICENSE.html or http://ckeditor.com/license command : 'maximize' } ); - // Restore the command state after mode change. + // Restore the command state after mode change, unless it has been changed to disabled (#6467) editor.on( 'mode', function() { - editor.getCommand( 'maximize' ).setState( savedState ); + var command = editor.getCommand( 'maximize' ); + command.setState( command.state == CKEDITOR.TRISTATE_DISABLED ? CKEDITOR.TRISTATE_DISABLED : savedState ); }, null, null, 100 ); } } );