X-Git-Url: https://jasonwoof.com/gitweb/?p=ckeditor.git;a=blobdiff_plain;f=_source%2Fplugins%2Fmaximize%2Fplugin.js;h=5f2715e84a9842a2be247914fff210d703923119;hp=9f1804371ec95c4d93e3aa6e53c48aeac6f0352f;hb=039a051ccf3901311661022a30afd60fc38130c9;hpb=c9fdde67e6384bd5a66adc2b3bba5c4ce9db56c7 diff --git a/_source/plugins/maximize/plugin.js b/_source/plugins/maximize/plugin.js index 9f18043..5f2715e 100644 --- a/_source/plugins/maximize/plugin.js +++ b/_source/plugins/maximize/plugin.js @@ -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,6 +194,14 @@ For licensing, see LICENSE.html or http://ckeditor.com/license container.setCustomData( 'maximize_saved_styles', saveStyles( container, true ) ); // Hide scroll bars. + var viewPaneSize = mainWindow.getViewPaneSize(); + var styles = + { + overflow : 'hidden', + width : ( CKEDITOR.env.opera ? viewPaneSize.width : 0 ) + 'px', + height : ( CKEDITOR.env.opera ? viewPaneSize.height - 16 : 0 ) + 'px' + }; + if ( CKEDITOR.env.ie ) { mainDocument.$.documentElement.style.overflow = @@ -201,21 +209,19 @@ For licensing, see LICENSE.html or http://ckeditor.com/license } else { - mainDocument.getBody().setStyles( - { - overflow : 'hidden', - width : '0px', - height : '0px' - } ); + mainDocument.getBody().setStyles( styles ); } + // #4023: [Opera] Maximize plugin + if ( CKEDITOR.env.opera ) + mainDocument.getBody().getParent().setStyles( styles ); + // Scroll to the top left (IE needs some time for it - #4923). CKEDITOR.env.ie ? setTimeout( function() { mainWindow.$.scrollTo( 0, 0 ); }, 0 ) : mainWindow.$.scrollTo( 0, 0 ); // Resize and move to top left. - var viewPaneSize = mainWindow.getViewPaneSize(); container.setStyle( 'position', 'absolute' ); container.$.offsetLeft; // SAFARI BUG: See #2066. container.setStyles( @@ -333,10 +339,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 ); } } );