X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=_source%2Fplugins%2Fmaximize%2Fplugin.js;h=fa2f7913098070bf8bdf3e074b79b2a7d7c180fa;hb=614511639979907ceb0da3614122a4d8eb963ad4;hp=a5a06fc1989f4b374e7904744036262758b7c429;hpb=8665a7c6c60586526e32e8941fe2896739b6ebfb;p=ckeditor.git diff --git a/_source/plugins/maximize/plugin.js b/_source/plugins/maximize/plugin.js index a5a06fc..fa2f791 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]; @@ -80,6 +80,21 @@ For licensing, see LICENSE.html or http://ckeditor.com/license function refreshCursor( editor ) { + // Refresh all editor instances on the page (#5724). + var all = CKEDITOR.instances; + for ( var i in all ) + { + var one = all[ i ]; + if ( one.mode == 'wysiwyg' ) + { + var body = one.document.getBody(); + // Refresh 'contentEditable' otherwise + // DOM lifting breaks design mode. (#5560) + body.setAttribute( 'contentEditable', false ); + body.setAttribute( 'contentEditable', true ); + } + } + if ( editor.focusManager.hasFocus ) { editor.toolbox.focus(); @@ -114,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; @@ -179,20 +194,17 @@ 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 viewPaneSize = mainWindow.getViewPaneSize(); + var styles = + { + overflow : 'hidden', + width : 0, + height : 0 + }; + + mainDocument.getDocumentElement().setStyles( styles ); + !CKEDITOR.env.gecko && mainDocument.getDocumentElement().setStyle( 'position', 'fixed' ); + mainDocument.getBody().setStyles( styles ); // Scroll to the top left (IE needs some time for it - #4923). CKEDITOR.env.ie ? @@ -200,7 +212,6 @@ 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' ); container.$.offsetLeft; // SAFARI BUG: See #2066. container.setStyles( @@ -211,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) @@ -224,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. { @@ -316,10 +329,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 ); } } );