JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
vanilla ckeditor-4.0_full
[ckeditor.git] / _source / plugins / autogrow / plugin.js
diff --git a/_source/plugins/autogrow/plugin.js b/_source/plugins/autogrow/plugin.js
deleted file mode 100644 (file)
index 253cb57..0000000
+++ /dev/null
@@ -1,161 +0,0 @@
-/*\r
-Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.\r
-For licensing, see LICENSE.html or http://ckeditor.com/license\r
-*/\r
-\r
-/**\r
- * @file AutoGrow plugin\r
- */\r
-(function(){\r
-\r
-       // Actual content height, figured out by appending check the last element's document position.\r
-       function contentHeight( scrollable )\r
-       {\r
-               var overflowY = scrollable.getStyle( 'overflow-y' );\r
-\r
-               var doc = scrollable.getDocument();\r
-               // Create a temporary marker element.\r
-               var marker = CKEDITOR.dom.element.createFromHtml( '<span style="margin:0;padding:0;border:0;clear:both;width:1px;height:1px;display:block;">' + ( CKEDITOR.env.webkit ? '&nbsp;' : '' ) + '</span>', doc );\r
-               doc[ CKEDITOR.env.ie? 'getBody' : 'getDocumentElement']().append( marker );\r
-\r
-               var height = marker.getDocumentPosition( doc ).y + marker.$.offsetHeight;\r
-               marker.remove();\r
-               scrollable.setStyle( 'overflow-y', overflowY );\r
-               return height;\r
-       }\r
-\r
-       function getScrollable( editor )\r
-       {\r
-               var doc = editor.document,\r
-                       body = doc.getBody(),\r
-                       htmlElement = doc.getDocumentElement();\r
-\r
-               // Quirks mode overflows body, standards overflows document element\r
-               return doc.$.compatMode == 'BackCompat' ? body : htmlElement;\r
-       }\r
-\r
-       var resizeEditor = function( editor )\r
-       {\r
-               if ( !editor.window )\r
-                       return;\r
-\r
-               var scrollable = getScrollable( editor ),\r
-                       currentHeight = editor.window.getViewPaneSize().height,\r
-                       newHeight = contentHeight( scrollable );\r
-\r
-               // Additional space specified by user.\r
-               newHeight += ( editor.config.autoGrow_bottomSpace || 0 );\r
-\r
-               var min = editor.config.autoGrow_minHeight != undefined ? editor.config.autoGrow_minHeight : 200,\r
-                       max = editor.config.autoGrow_maxHeight || Infinity;\r
-\r
-               newHeight = Math.max( newHeight, min );\r
-               newHeight = Math.min( newHeight, max );\r
-\r
-               if ( newHeight != currentHeight )\r
-               {\r
-                       newHeight = editor.fire( 'autoGrow', { currentHeight : currentHeight, newHeight : newHeight } ).newHeight;\r
-                       editor.resize( editor.container.getStyle( 'width' ), newHeight, true );\r
-               }\r
-\r
-               if ( scrollable.$.scrollHeight > scrollable.$.clientHeight && newHeight < max )\r
-                       scrollable.setStyle( 'overflow-y', 'hidden' );\r
-               else\r
-                       scrollable.removeStyle( 'overflow-y' );\r
-\r
-\r
-       };\r
-\r
-       CKEDITOR.plugins.add( 'autogrow',\r
-       {\r
-               init : function( editor )\r
-               {\r
-                       editor.addCommand( 'autogrow', { exec : resizeEditor, modes : { wysiwyg:1 }, readOnly: 1, canUndo: false, editorFocus: false } );\r
-\r
-                       var eventsList = { contentDom:1, key:1, selectionChange:1, insertElement:1, mode:1 };\r
-                       editor.config.autoGrow_onStartup && ( eventsList[ 'instanceReady' ] = 1 );\r
-                       for ( var eventName in eventsList )\r
-                       {\r
-                               editor.on( eventName, function( evt )\r
-                               {\r
-                                       var maximize = editor.getCommand( 'maximize' );\r
-                                       // Some time is required for insertHtml, and it gives other events better performance as well.\r
-                                       if ( evt.editor.mode == 'wysiwyg' &&\r
-                                               // Disable autogrow when the editor is maximized .(#6339)\r
-                                               ( !maximize || maximize.state != CKEDITOR.TRISTATE_ON ) )\r
-                                       {\r
-                                               setTimeout( function()\r
-                                               {\r
-                                                       resizeEditor( evt.editor );\r
-                                                       // Second pass to make correction upon\r
-                                                       // the first resize, e.g. scrollbar.\r
-                                                       resizeEditor( evt.editor );\r
-                                               }, 100 );\r
-                                       }\r
-                               });\r
-                       }\r
-\r
-                       // Coordinate with the "maximize" plugin. (#9311)\r
-                       editor.on( 'beforeCommandExec', function( evt )\r
-                       {\r
-                               if ( evt.data.name == 'maximize' && evt.editor.mode == 'wysiwyg' )\r
-                               {\r
-                                       if ( evt.data.command.state == CKEDITOR.TRISTATE_OFF )\r
-                                       {\r
-                                               var scrollable = getScrollable( editor );\r
-                                               scrollable.removeStyle( 'overflow' );\r
-                                       }\r
-                                       else\r
-                                               resizeEditor( editor );\r
-                               }\r
-                       });\r
-               }\r
-       });\r
-})();\r
-/**\r
- * The minimum height that the editor can reach using the AutoGrow feature.\r
- * @name CKEDITOR.config.autoGrow_minHeight\r
- * @type Number\r
- * @default <code>200</code>\r
- * @since 3.4\r
- * @example\r
- * config.autoGrow_minHeight = 300;\r
- */\r
-\r
-/**\r
- * The maximum height that the editor can reach using the AutoGrow feature. Zero means unlimited.\r
- * @name CKEDITOR.config.autoGrow_maxHeight\r
- * @type Number\r
- * @default <code>0</code>\r
- * @since 3.4\r
- * @example\r
- * config.autoGrow_maxHeight = 400;\r
- */\r
-\r
- /**\r
- * Whether to have the auto grow happen on editor creation.\r
- * @name CKEDITOR.config.autoGrow_onStartup\r
- * @type Boolean\r
- * @default false\r
- * @since 3.6.2\r
- * @example\r
- * config.autoGrow_onStartup = true;\r
- */\r
-\r
-/**\r
- * Fired when the AutoGrow plugin is about to change the size of the editor.\r
- * @name CKEDITOR.editor#autogrow\r
- * @event\r
- * @param {Number} data.currentHeight The current height of the editor (before resizing).\r
- * @param {Number} data.newHeight The new height of the editor (after resizing). It can be changed\r
- *                             to determine a different height value to be used instead.\r
- */\r
-\r
-\r
-/**\r
- *  Extra height in pixel to leave between the bottom boundary of content with document size when auto resizing.\r
- * @name CKEDITOR.config.autoGrow_bottomSpace\r
- * @type Number\r
- * @default 0\r
- * @since 3.6.2\r
- */\r