X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=_source%2Fplugins%2Fautogrow%2Fplugin.js;h=253cb57732771655adf6782a77bf84875981d57e;hb=a272c66d841421f8bf933c16535bdcde1c4649fc;hp=c8c668eb834aa158316dcff8d6e0c83b6fc4ddcc;hpb=e73319a12b56100b29ef456fd74114fe5519e01c;p=ckeditor.git diff --git a/_source/plugins/autogrow/plugin.js b/_source/plugins/autogrow/plugin.js index c8c668e..253cb57 100644 --- a/_source/plugins/autogrow/plugin.js +++ b/_source/plugins/autogrow/plugin.js @@ -1,5 +1,5 @@ /* -Copyright (c) 2003-2011, 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. @@ -67,7 +72,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license { editor.addCommand( 'autogrow', { exec : resizeEditor, modes : { wysiwyg:1 }, readOnly: 1, canUndo: false, editorFocus: false } ); - var eventsList = { contentDom:1, key:1, selectionChange:1, insertElement:1 }; + var eventsList = { contentDom:1, key:1, selectionChange:1, insertElement:1, mode:1 }; editor.config.autoGrow_onStartup && ( eventsList[ 'instanceReady' ] = 1 ); for ( var eventName in eventsList ) { @@ -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 ); + } + }); } }); })();