Ticket #5649: 5649_2.patch

File 5649_2.patch, 2.3 KB (added by Tobiasz Cudnik, 14 years ago)
  • _source/plugins/dialog/plugin.js

     
    6868                return null;
    6969        }
    7070
     71
     72        function clearOrRecoverTextInputValue( container, isRecover )
     73        {
     74                var inputs = container.$.getElementsByTagName( 'input' );
     75                for ( var i = 0, length = inputs.length; i < length ; i++ )
     76                {
     77                        var item = new CKEDITOR.dom.element( inputs[ i ] );
     78
     79                        if ( item.getAttribute( 'type' ).toLowerCase() == 'text' )
     80                        {
     81                                if ( isRecover )
     82                                {
     83                                        item.setAttribute( 'value', item.getCustomData( 'fake_value' ) || '' );
     84                                        item.removeCustomData( 'fake_value' );
     85                                }
     86                                else
     87                                {
     88                                        item.setCustomData( 'fake_value', item.getAttribute( 'value' ) );
     89                                        item.setAttribute( 'value', '' );
     90                                }
     91                        }
     92                }
     93        }
     94
    7195        /**
    7296         * This is the base class for runtime dialog objects. An instance of this
    7397         * class represents a single named dialog for a single editor instance.
     
    685709                        // First, set the dialog to an appropriate size.
    686710                        this.resize( definition.minWidth, definition.minHeight );
    687711
    688                         // Select the first tab by default.
    689                         this.selectPage( this.definition.contents[0].id );
    690 
    691712                        // Reset all inputs back to their default value.
    692713                        this.reset();
    693714
     715                        // Select the first tab by default.
     716                        this.selectPage( this.definition.contents[0].id );
     717
    694718                        // Set z-index.
    695719                        if ( CKEDITOR.dialog._.currentZIndex === null )
    696720                                CKEDITOR.dialog._.currentZIndex = this._.editor.config.baseFloatZIndex;
     
    968992
    969993                        var selected = this._.tabs[id];
    970994                        selected[0].addClass( 'cke_dialog_tab_selected' );
    971                         selected[1].show();
     995                       
     996                        // [IE] a unvisible input[type='text'] will enlarge it's width
     997                        // if it's value is long when it show( #5649 )
     998                        // so we clear it's value before it shows and then recover it
     999                        if ( CKEDITOR.env.ie6Compat || CKEDITOR.env.ie7Compat )
     1000                        {
     1001                                clearOrRecoverTextInputValue( selected[1] );
     1002                                selected[1].show();
     1003                                setTimeout( function()
     1004                                {
     1005                                        clearOrRecoverTextInputValue( selected[1], true );
     1006                                }, 0 );
     1007                        }
     1008                        else
     1009                        {
     1010                                selected[1].show();
     1011                        }       
     1012                       
     1013
    9721014                        this._.currentTabId = id;
    9731015                        this._.currentTabIndex = CKEDITOR.tools.indexOf( this._.tabIdList, id );
    9741016                },
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy