X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=_source%2Fplugins%2Fautogrow%2Fplugin.js;h=253cb57732771655adf6782a77bf84875981d57e;hb=3fe9cac293e090ea459a3ee10d78cbe9e1dd0e03;hp=fdbb5786787cdc09b567d3386743ca1b3d5d25fe;hpb=2f22c0c38f17e75be5541089076885442aaa2377;p=ckeditor.git diff --git a/_source/plugins/autogrow/plugin.js b/_source/plugins/autogrow/plugin.js index fdbb578..253cb57 100644 --- a/_source/plugins/autogrow/plugin.js +++ b/_source/plugins/autogrow/plugin.js @@ -1,5 +1,5 @@ /* -Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. +Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ @@ -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 ); + } + }); } }); })();