Ticket #4231: 4231_2.patch

File 4231_2.patch, 2.4 KB (added by Alfonso Martínez de Lizarrondo, 14 years ago)

Revised patch

  • _source/plugins/resize/plugin.js

     
    1111
    1212                if ( config.resize_enabled )
    1313                {
    14                         var container = null;
    15                         var origin, startSize;
     14                        var container = null,
     15                                origin,
     16                                startSize,
     17                                resizeHorizontal = ( config.resize_dir == 'both' || config.resize_dir == 'horizontal' ) &&
     18                                        ( config.resize_minWidth != config.resize_maxWidth ),
     19                                resizeVertical = ( config.resize_dir == 'both' || config.resize_dir == 'vertical' ) &&
     20                                        ( config.resize_minHeight != config.resize_maxHeight );
    1621
    1722                        function dragHandler( evt )
    1823                        {
    19                                 var dx = evt.data.$.screenX - origin.x;
    20                                 var dy = evt.data.$.screenY - origin.y;
    21                                 var internalWidth = startSize.width + dx * ( editor.lang.dir == 'rtl' ? -1 : 1 );
    22                                 var internalHeight = startSize.height + dy;
     24                                var dx = evt.data.$.screenX - origin.x,
     25                                        dy = evt.data.$.screenY - origin.y,
     26                                        width = startSize.width,
     27                                        height = startSize.height,
     28                                        internalWidth = width + dx * ( editor.lang.dir == 'rtl' ? -1 : 1 ),
     29                                        internalHeight = height + dy;
    2330
    24                                 editor.resize( Math.max( config.resize_minWidth, Math.min( internalWidth, config.resize_maxWidth ) ),
    25                                                 Math.max( config.resize_minHeight, Math.min( internalHeight, config.resize_maxHeight ) ) );
     31                                if ( resizeHorizontal )
     32                                        width =  Math.max( config.resize_minWidth, Math.min( internalWidth, config.resize_maxWidth ) );
     33
     34                                if ( resizeVertical )
     35                                        height =  Math.max( config.resize_minHeight, Math.min( internalHeight, config.resize_maxHeight ) );
     36
     37                                editor.resize( width, height );
    2638                        }
    2739
    2840                        function dragEndHandler ( evt )
     
    108120CKEDITOR.config.resize_maxHeight = 3000;
    109121
    110122/**
    111  * Whether to enable the resizing feature. If disabed the resize handler will not be visible.
     123 * Whether to enable the resizing feature. If disabled the resize handler will not be visible.
    112124 * @type Boolean
    113125 * @default true
    114126 * @example
    115127 * config.resize_enabled = false;
    116128 */
    117129CKEDITOR.config.resize_enabled = true;
     130
     131/**
     132 * The directions where resizing is enabled. It can be 'both', 'vertical' or 'horizontal'
     133 * @type String
     134 * @default 'both'
     135 * @since 3.3
     136 * @example
     137 * config.resize_dir = 'vertical';
     138 */
     139
     140CKEDITOR.config.resize_dir = 'both';
     141 No newline at end of file
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy