JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
vanilla ckeditor-3.6.3
[ckeditor.git] / _source / plugins / resize / plugin.js
index f520a8e..3fbec77 100644 (file)
@@ -1,5 +1,5 @@
 /*\r
-Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.\r
+Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.\r
 For licensing, see LICENSE.html or http://ckeditor.com/license\r
 */\r
 \r
@@ -9,6 +9,10 @@ CKEDITOR.plugins.add( 'resize',
        {\r
                var config = editor.config;\r
 \r
+               // Resize in the same direction of chrome,\r
+               // which is identical to dir of editor element. (#6614)\r
+               var resizeDir = editor.element.getDirection( 1 );\r
+\r
                !config.resize_dir && ( config.resize_dir = 'both' );\r
                ( config.resize_maxWidth == undefined ) && ( config.resize_maxWidth = 3000 );\r
                ( config.resize_maxHeight == undefined ) && ( config.resize_maxHeight = 3000 );\r
@@ -31,7 +35,7 @@ CKEDITOR.plugins.add( 'resize',
                                        dy = evt.data.$.screenY - origin.y,\r
                                        width = startSize.width,\r
                                        height = startSize.height,\r
-                                       internalWidth = width + dx * ( editor.lang.dir == 'rtl' ? -1 : 1 ),\r
+                                       internalWidth = width + dx * ( resizeDir == 'rtl' ? -1 : 1 ),\r
                                        internalHeight = height + dy;\r
 \r
                                if ( resizeHorizontal )\r
@@ -40,7 +44,8 @@ CKEDITOR.plugins.add( 'resize',
                                if ( resizeVertical )\r
                                        height =  Math.max( config.resize_minHeight, Math.min( internalHeight, config.resize_maxHeight ) );\r
 \r
-                               editor.resize( width, height );\r
+                               // DO NOT impose fixed size with single direction resize. (#6308)\r
+                               editor.resize( resizeHorizontal ? width : null, height );\r
                        }\r
 \r
                        function dragEndHandler ( evt )\r
@@ -88,10 +93,17 @@ CKEDITOR.plugins.add( 'resize',
                                                if ( !resizeHorizontal && resizeVertical )\r
                                                        direction = ' cke_resizer_vertical';\r
 \r
-                                               event.data.html += '<div class="cke_resizer' + direction + '"' +\r
+                                               var resizerHtml =\r
+                                                       '<div' +\r
+                                                       ' class="cke_resizer' + direction + ' cke_resizer_' + resizeDir + '"' +\r
                                                        ' title="' + CKEDITOR.tools.htmlEncode( editor.lang.resize ) + '"' +\r
                                                        ' onmousedown="CKEDITOR.tools.callFunction(' + mouseDownFn + ', event)"' +\r
                                                        '></div>';\r
+\r
+                                               // Always sticks the corner of botttom space.\r
+                                               resizeDir == 'ltr' && direction == 'ltr' ?\r
+                                                       event.data.html += resizerHtml :\r
+                                                       event.data.html = resizerHtml + event.data.html;\r
                                        }\r
                                }, editor, null, 100 );\r
                }\r
@@ -99,8 +111,8 @@ CKEDITOR.plugins.add( 'resize',
 } );\r
 \r
 /**\r
- * The minimum editor width, in pixels, when resizing it with the resize handle.\r
- * Note: It fallbacks to editor's actual width if that's smaller than the default value.\r
+ * The minimum editor width, in pixels, when resizing the editor interface by using the resize handle.\r
+ * Note: It falls back to editor's actual width if it is smaller than the default value.\r
  * @name CKEDITOR.config.resize_minWidth\r
  * @type Number\r
  * @default 750\r
@@ -109,8 +121,8 @@ CKEDITOR.plugins.add( 'resize',
  */\r
 \r
 /**\r
- * The minimum editor height, in pixels, when resizing it with the resize handle.\r
- * Note: It fallbacks to editor's actual height if that's smaller than the default value.\r
+ * The minimum editor height, in pixels, when resizing the editor interface by using the resize handle.\r
+ * Note: It falls back to editor's actual height if it is smaller than the default value.\r
  * @name CKEDITOR.config.resize_minHeight\r
  * @type Number\r
  * @default 250\r
@@ -119,7 +131,7 @@ CKEDITOR.plugins.add( 'resize',
  */\r
 \r
 /**\r
- * The maximum editor width, in pixels, when resizing it with the resize handle.\r
+ * The maximum editor width, in pixels, when resizing the editor interface by using the resize handle.\r
  * @name CKEDITOR.config.resize_maxWidth\r
  * @type Number\r
  * @default 3000\r
@@ -128,7 +140,7 @@ CKEDITOR.plugins.add( 'resize',
  */\r
 \r
 /**\r
- * The maximum editor height, in pixels, when resizing it with the resize handle.\r
+ * The maximum editor height, in pixels, when resizing the editor interface by using the resize handle.\r
  * @name CKEDITOR.config.resize_maxHeight\r
  * @type Number\r
  * @default 3000\r
@@ -137,7 +149,7 @@ CKEDITOR.plugins.add( 'resize',
  */\r
 \r
 /**\r
- * Whether to enable the resizing feature. If disabled the resize handler will not be visible.\r
+ * Whether to enable the resizing feature. If this feature is disabled, the resize handle will not be visible.\r
  * @name CKEDITOR.config.resize_enabled\r
  * @type Boolean\r
  * @default true\r
@@ -146,8 +158,8 @@ CKEDITOR.plugins.add( 'resize',
  */\r
 \r
 /**\r
- * The directions to which the editor resizing is enabled. Possible values\r
- * are "both", "vertical" and "horizontal".\r
+ * The dimensions for which the editor resizing is enabled. Possible values\r
+ * are <code>both</code>, <code>vertical</code>, and <code>horizontal</code>.\r
  * @name CKEDITOR.config.resize_dir\r
  * @type String\r
  * @default 'both'\r