X-Git-Url: https://jasonwoof.com/gitweb/?p=ckeditor.git;a=blobdiff_plain;f=_source%2Fplugins%2Fautogrow%2Fplugin.js;h=6ffef63571fd0845cba92407413a0e09e99a44b5;hp=fdbb5786787cdc09b567d3386743ca1b3d5d25fe;hb=fb481ba0a7d298e3e7b9034fcb9f2afdc6e8e796;hpb=6e682412d5cc0dfaedb376482e585bf2989c6863 diff --git a/_source/plugins/autogrow/plugin.js b/_source/plugins/autogrow/plugin.js index fdbb578..6ffef63 100644 --- a/_source/plugins/autogrow/plugin.js +++ b/_source/plugins/autogrow/plugin.js @@ -24,18 +24,23 @@ For licensing, see LICENSE.html or http://ckeditor.com/license return height; } + function getScrollable( editor ) + { + var doc = editor.document, + body = doc.getBody(), + htmlElement = doc.getDocumentElement(); + + // Quirks mode overflows body, standards overflows document element + return doc.$.compatMode == 'BackCompat' ? body : htmlElement; + } + var resizeEditor = function( editor ) { if ( !editor.window ) return; - var doc = editor.document, - iframe = new CKEDITOR.dom.element( doc.getWindow().$.frameElement ), - body = doc.getBody(), - htmlElement = doc.getDocumentElement(), + var scrollable = getScrollable( editor ), currentHeight = editor.window.getViewPaneSize().height, - // Quirks mode overflows body, standards overflows document element - scrollable = doc.$.compatMode == 'BackCompat' ? body : htmlElement, newHeight = contentHeight( scrollable ); // Additional space specified by user. @@ -89,6 +94,21 @@ For licensing, see LICENSE.html or http://ckeditor.com/license } }); } + + // Coordinate with the "maximize" plugin. (#9311) + editor.on( 'beforeCommandExec', function( evt ) + { + if ( evt.data.name == 'maximize' && evt.editor.mode == 'wysiwyg' ) + { + if ( evt.data.command.state == CKEDITOR.TRISTATE_OFF ) + { + var scrollable = getScrollable( editor ); + scrollable.removeStyle( 'overflow' ); + } + else + resizeEditor( editor ); + } + }); } }); })();