One more thing. Besides styles and setting height to auto there is still some JavaScript needed to properly handle modes (source/wysiwyg) changes and maximize functionality.
Please see attached file for more details - _divarea_autogrow.html.
Below is the code that needs to be inserted into page:
editor.on( 'instanceReady', function( e ) {
var contentDiv = document.getElementById( 'cke_' +editor.name ).getElementsByTagName( 'div' )[0];
var contentParent = contentDiv.parentNode;
var computedHeight;
editor.on( 'beforeModeUnload', function( evt ) {
if ( evt.editor.mode == 'wysiwyg' && evt.editor.getCommand( 'maximize' ).state == CKEDITOR.TRISTATE_OFF )
computedHeight = window.getComputedStyle(contentDiv,null).getPropertyValue("height");
computedHeight = (computedHeight == '100%') ? window.getComputedStyle(contentParent,null).getPropertyValue("height") : computedHeight;
});
editor.on( 'mode', function( evt ) {
if ( evt.editor.mode == 'source' && evt.editor.getCommand( 'maximize' ).state == CKEDITOR.TRISTATE_OFF )
contentParent.getElementsByTagName( 'textarea' )[0].style.height = computedHeight;
});
editor.on( 'beforeCommandExec', function( evt ) {
if( evt.data.name == 'maximize' && evt.editor.mode == 'source' ) {
if( evt.editor.getCommand( 'maximize' ).state == CKEDITOR.TRISTATE_OFF ) {
contentParent.getElementsByTagName( 'textarea' )[0].style.height = '100%';
} else
contentParent.getElementsByTagName( 'textarea' )[0].style.height = computedHeight;
} else if ( evt.data.name == 'maximize' && evt.editor.mode == 'wysiwyg' ) {
computedHeight = window.getComputedStyle(contentDiv,null).getPropertyValue("height");
computedHeight = (computedHeight == '100%') ? window.getComputedStyle(contentParent,null).getPropertyValue("height") : computedHeight;
}
});
});