Ticket #6491: 6491_2.patch

File 6491_2.patch, 2.1 KB (added by Garry Yao, 13 years ago)
  • _source/plugins/image/dialogs/image.js

     
    121121                        if( !oImageOriginal )
    122122                                return null;
    123123
    124                         var ratioButton = CKEDITOR.document.getById( btnLockSizesId );
    125 
    126                         if ( oImageOriginal.getCustomData( 'isReady' ) == 'true' )
     124                        // Check image ratio and original image ratio, but respecting user's preference.
     125                        if ( value == 'check' )
    127126                        {
    128                                 if ( value == 'check' )                 // Check image ratio and original image ratio.
     127                                if ( !dialog.userlockRatio && oImageOriginal.getCustomData( 'isReady' ) == 'true'  )
    129128                                {
    130129                                        var width = dialog.getValueOf( 'info', 'txtWidth' ),
    131130                                                height = dialog.getValueOf( 'info', 'txtHeight' ),
     
    141140                                                        dialog.lockRatio = true;
    142141                                        }
    143142                                }
    144                                 else if ( value != undefined )
    145                                         dialog.lockRatio = value;
    146                                 else
    147                                         dialog.lockRatio = !dialog.lockRatio;
     143                        }
     144                        else if ( value != undefined )
     145                                dialog.lockRatio = value;
     146                        else
     147                        {
     148                                dialog.userlockRatio = 1;
     149                                dialog.lockRatio = !dialog.lockRatio;
    148150                        }
    149                         else if ( value != 'check' )            // I can't lock ratio if ratio is unknown.
    150                                 dialog.lockRatio = false;
    151151
     152                        var ratioButton = CKEDITOR.document.getById( btnLockSizesId );
    152153                        if ( dialog.lockRatio )
    153154                                ratioButton.removeClass( 'cke_btn_unlocked' );
    154155                        else
     
    275276                                this.linkEditMode = false;
    276277
    277278                                this.lockRatio = true;
     279                                this.userlockRatio = 0;
    278280                                this.dontResetSize = false;
    279281                                this.firstLoad = true;
    280282                                this.addLink = false;
     
    335337
    336338                                        // Fill out all fields.
    337339                                        this.setupContent( IMAGE, this.imageElement );
    338 
    339                                         // Refresh LockRatio button
    340                                         switchLockRatio ( this, true );
    341340                                }
    342341                                else
    343342                                        this.imageElement =  editor.document.createElement( 'img' );
    344343
     344                                // Refresh LockRatio button
     345                                switchLockRatio ( this, true );
     346
    345347                                // Dont show preview if no URL given.
    346348                                if ( !CKEDITOR.tools.trim( this.getValueOf( 'info', 'txtUrl' ) ) )
    347349                                {
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy