X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=_source%2Fplugins%2Fmaximize%2Fplugin.js;h=bcb726c8d5c60f2a6c868100a98cc93cb7e8124e;hb=f8fc585c18d287eb325c575596d183122486b641;hp=2258c5a9f5eba6f6a14dc3970469ba8e58a943e9;hpb=e7789c1ad838194d45eeee6ac2eb6e55f5cf35a1;p=ckeditor.git diff --git a/_source/plugins/maximize/plugin.js b/_source/plugins/maximize/plugin.js index 2258c5a..bcb726c 100644 --- a/_source/plugins/maximize/plugin.js +++ b/_source/plugins/maximize/plugin.js @@ -78,31 +78,52 @@ For licensing, see LICENSE.html or http://ckeditor.com/license restoreFormStyles( data ); } - function getResizeHandler( mainWindow, editor ) + function refreshCursor( editor ) { - return function() + // Refresh all editor instances on the page (#5724). + var all = CKEDITOR.instances; + for ( var i in all ) { - var viewPaneSize = mainWindow.getViewPaneSize(); - editor.resize( viewPaneSize.width, viewPaneSize.height, null, true ); - }; - } + 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 ); + } + } - function refreshCursor( editor ) - { if ( editor.focusManager.hasFocus ) { - var focusGrabber = editor.container.append( CKEDITOR.dom.element.createFromHtml( - '' ) ); - - focusGrabber.on( 'focus', function() - { - editor.focus(); - } ); - focusGrabber.focus(); - focusGrabber.remove(); + editor.toolbox.focus(); + editor.focus(); } } + /** + * Adding an iframe shim to this element, OR removing the existing one if already applied. + * Note: This will only affect IE version below 7. + */ + function createIframeShim( element ) + { + if ( !CKEDITOR.env.ie || CKEDITOR.env.version > 6 ) + return null; + + var shim = CKEDITOR.dom.element.createFromHtml( '' ); + return element.append( shim, true ); + } + CKEDITOR.plugins.add( 'maximize', { init : function( editor ) @@ -118,8 +139,15 @@ For licensing, see LICENSE.html or http://ckeditor.com/license // Saved scroll position for the outer window. var outerScroll; + var shim; + // Saved resize handler function. - var resizeHandler = getResizeHandler( mainWindow, editor ); + function resizeHandler() + { + var viewPaneSize = mainWindow.getViewPaneSize(); + shim && shim.setStyles( { width : viewPaneSize.width + 'px', height : viewPaneSize.height + 'px' } ); + editor.resize( viewPaneSize.width, viewPaneSize.height, null, true ); + } // Retain state after mode switches. var savedState = CKEDITOR.TRISTATE_OFF; @@ -196,7 +224,9 @@ For licensing, see LICENSE.html or http://ckeditor.com/license left : '0px', top : '0px' } ); - editor.resize( viewPaneSize.width, viewPaneSize.height, null, true ); + + shim = createIframeShim( container ); // IE6 select element penetration when maximized. (#4459) + resizeHandler(); // Still not top left? Fix it. (Bug #174) var offset = container.getDocumentPosition(); @@ -240,6 +270,12 @@ For licensing, see LICENSE.html or http://ckeditor.com/license // Remove cke_maximized class. container.removeClass( 'cke_maximized' ); + if ( shim ) + { + shim.remove(); + shim = null; + } + // Emit a resize event, because this time the size is modified in // restoreStyles. editor.fire( 'resize' );