JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
vanilla ckeditor-3.4.2
[ckeditor.git] / _source / plugins / resize / plugin.js
index 8c25035..571ac53 100644 (file)
@@ -9,7 +9,13 @@ CKEDITOR.plugins.add( 'resize',
        {\r
                var config = editor.config;\r
 \r
-               if ( config.resize_enabled )\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
+               ( config.resize_minWidth == undefined ) && ( config.resize_minWidth = 750 );\r
+               ( config.resize_minHeight == undefined ) && ( config.resize_minHeight = 250 );\r
+\r
+               if ( config.resize_enabled !== false )\r
                {\r
                        var container = null,\r
                                origin,\r
@@ -57,6 +63,9 @@ CKEDITOR.plugins.add( 'resize',
                                        startSize = { width : container.$.offsetWidth || 0, height : container.$.offsetHeight || 0 };\r
                                        origin = { x : $event.screenX, y : $event.screenY };\r
 \r
+                                       config.resize_minWidth > startSize.width && ( config.resize_minWidth = startSize.width );\r
+                                       config.resize_minHeight > startSize.height && ( config.resize_minHeight = startSize.height );\r
+\r
                                        CKEDITOR.document.on( 'mousemove', dragHandler );\r
                                        CKEDITOR.document.on( 'mouseup', dragEndHandler );\r
 \r
@@ -74,9 +83,9 @@ CKEDITOR.plugins.add( 'resize',
                                        if ( event.data.space == 'bottom' )\r
                                        {\r
                                                var direction = '';\r
-                                               if ( resizeHorizontal && !resizeVertical)\r
+                                               if ( resizeHorizontal && !resizeVertical )\r
                                                        direction = ' cke_resizer_horizontal';\r
-                                               if ( !resizeHorizontal && resizeVertical)\r
+                                               if ( !resizeHorizontal && resizeVertical )\r
                                                        direction = ' cke_resizer_vertical';\r
 \r
                                                event.data.html += '<div class="cke_resizer' + direction + '"' +\r
@@ -91,56 +100,58 @@ CKEDITOR.plugins.add( 'resize',
 \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
+ * @name CKEDITOR.config.resize_minWidth\r
  * @type Number\r
  * @default 750\r
  * @example\r
  * config.resize_minWidth = 500;\r
  */\r
-CKEDITOR.config.resize_minWidth = 750;\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
+ * @name CKEDITOR.config.resize_minHeight\r
  * @type Number\r
  * @default 250\r
  * @example\r
  * config.resize_minHeight = 600;\r
  */\r
-CKEDITOR.config.resize_minHeight = 250;\r
 \r
 /**\r
  * The maximum editor width, in pixels, when resizing it with the resize handle.\r
+ * @name CKEDITOR.config.resize_maxWidth\r
  * @type Number\r
  * @default 3000\r
  * @example\r
  * config.resize_maxWidth = 750;\r
  */\r
-CKEDITOR.config.resize_maxWidth = 3000;\r
 \r
 /**\r
  * The maximum editor height, in pixels, when resizing it with the resize handle.\r
+ * @name CKEDITOR.config.resize_maxHeight\r
  * @type Number\r
  * @default 3000\r
  * @example\r
  * config.resize_maxHeight = 600;\r
  */\r
-CKEDITOR.config.resize_maxHeight = 3000;\r
 \r
 /**\r
  * Whether to enable the resizing feature. If disabled the resize handler will not be visible.\r
+ * @name CKEDITOR.config.resize_enabled\r
  * @type Boolean\r
  * @default true\r
  * @example\r
  * config.resize_enabled = false;\r
  */\r
-CKEDITOR.config.resize_enabled = true;\r
 \r
 /**\r
  * The directions to which the editor resizing is enabled. Possible values\r
  * are "both", "vertical" and "horizontal".\r
+ * @name CKEDITOR.config.resize_dir\r
  * @type String\r
  * @default 'both'\r
  * @since 3.3\r
  * @example\r
  * config.resize_dir = 'vertical';\r
  */\r
-CKEDITOR.config.resize_dir = 'both';\r