Ticket #4527: 4527.patch

File 4527.patch, 2.3 KB (added by Garry Yao, 14 years ago)
  • _source/plugins/forms/dialogs/checkbox.js

     
    7979                                                accessKey : 'V',
    8080                                                setup : function( element )
    8181                                                {
    82                                                         this.setValue( element.getAttribute( 'value' ) || '' );
     82                                                        var value = element.getAttribute( 'value' );
     83                                                        this.setValue(  CKEDITOR.env.ie && value == 'on' ? '' : value  );
    8384                                                },
    8485                                                commit : function( data )
    8586                                                {
     
    115116                                                                {
    116117                                                                        var replace = CKEDITOR.dom.element.createFromHtml( '<input type="checkbox"'
    117118                                                                                   + ( isChecked ? ' checked="checked"' : '' )
    118                                                                                    + '></input>', editor.document );
     119                                                                                   + '/>', editor.document );
     120
    119121                                                                        element.copyAttributes( replace, { type : 1, checked : 1 } );
    120122                                                                        replace.replace( element );
    121123                                                                        editor.getSelection().selectElement( replace );
     
    124126                                                        }
    125127                                                        else
    126128                                                        {
    127                                                                 if ( this.getValue() )
    128                                                                         element.setAttribute( 'checked', this.getValue() );
     129                                                                var value = this.getValue();
     130                                                                if ( value )
     131                                                                        element.setAttribute( 'checked', 'checked' );
    129132                                                                else
    130133                                                                        element.removeAttribute( 'checked' );
    131134                                                        }
  • _source/plugins/forms/plugin.js

     
    162162                                });
    163163                }
    164164        },
     165
     166        afterInit : function( editor )
     167        {
     168                // Cleanup certain IE form elements default values.
     169                if( CKEDITOR.env.ie )
     170                {
     171                        var dataProcessor = editor.dataProcessor,
     172                                htmlFilter = dataProcessor && dataProcessor.htmlFilter;
     173
     174                        htmlFilter && htmlFilter.addRules(
     175                        {
     176                                elements :
     177                                {
     178                                        input : function( input )
     179                                        {
     180                                                var attrs = input.attributes,
     181                                                        type = attrs.type;
     182                                                if( type == 'checkbox' || type == 'radio' )
     183                                                {
     184                                                        attrs.checked == '0' && delete attrs.checked;
     185                                                        attrs.value == 'on' && delete attrs.value;
     186                                                }
     187                                        }
     188                                }
     189                        } );
     190                }
     191        },
    165192        requires : [ 'image' ]
    166193} );
    167194
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy