Index: _samples/autogrow.html
===================================================================
--- _samples/autogrow.html (revision 0)
+++ _samples/autogrow.html (revision 0)
@@ -0,0 +1,79 @@
+
+
+
+
+ AutoGrow Plugin - CKEditor Sample
+
+
+
+
+
+
+
+
+
+ CKEditor Sample
+
+
+
+
+
+
+
+
+
Index: _source/plugins/autogrow/plugin.js
===================================================================
--- _source/plugins/autogrow/plugin.js (revision 0)
+++ _source/plugins/autogrow/plugin.js (revision 0)
@@ -0,0 +1,78 @@
+/*
+Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
+For licensing, see LICENSE.html or http://ckeditor.com/license
+*/
+
+/**
+ * @file AutoGrow plugin
+ */
+(function(){
+ var resizeEditor = function( editor )
+ {
+ var doc = editor.document,
+ documentElement = doc.getDocumentElement().$,
+ currentHeight = editor.window.getViewPaneSize().height,
+ newHeight;
+
+ if ( CKEDITOR.env.ie )
+ newHeight = documentElement.scrollHeight;
+ else
+ newHeight = documentElement.offsetHeight;
+
+ var min = editor.config.autoGrow_minHeight,
+ max = editor.config.autoGrow_maxHeight;
+ if ( min )
+ newHeight = Math.max( newHeight, min );
+ if ( max )
+ newHeight = Math.min( newHeight, max );
+
+ if ( newHeight != currentHeight )
+ {
+ newHeight = editor.fire( 'autoGrow', { currentHeight : currentHeight, newHeight : newHeight } ).newHeight;
+ editor.resize( editor.container.getStyle( 'width' ), newHeight, true );
+ }
+ };
+ CKEDITOR.plugins.add( 'autogrow',
+ {
+ init : function( editor )
+ {
+ for ( var eventName in { contentDom:1, key:1, selectionChange:1, insertElement:1 } )
+ {
+ editor.on( eventName, function( evt )
+ {
+ // Some time is required for insertHtml, and it gives other events better performance as well.
+ if ( evt.editor.mode == 'wysiwyg' )
+ setTimeout( function(){ resizeEditor( evt.editor ); }, 100 );
+ });
+ }
+ }
+ });
+})();
+/**
+ * The minimum height to which the editor can reach using AutoGrow.
+ * @name autoGrow_minHeight
+ * @type Number
+ * @default 200
+ * @example
+ * config.autoGrow_minHeight = 300;
+ */
+CKEDITOR.config.autoGrow_minHeight = 200;
+
+/**
+ * The maximum height to which the editor can reach using AutoGrow. Zero means unlimited.
+ * @name autoGrow_maxHeight
+ * @type Number
+ * @default 0
+ * @example
+ * config.autoGrow_maxHeight = 400;
+ */
+CKEDITOR.config.autoGrow_maxHeight = 0;
+
+/**
+ * Fired when the AutoGrow plugin is about to change the size of the editor.
+ * @name CKEDITOR#autogrow
+ * @event
+ * @param {Number} data.currentHeight The current height of the editor (before the resizing).
+ * @param {Number} data.newHeight The new height of the editor (after the resizing). It can be changed
+ * to determine another height to be used instead.
+ */