Ticket #5500: 5500_3.patch
File 5500_3.patch, 4.9 KB (added by , 13 years ago) |
---|
-
_source/core/dom/element.js
452 452 } 453 453 454 454 case 'hspace': 455 return this.$.hspace; 455 case 'value': 456 return this.$[ name ]; 456 457 457 458 case 'style': 458 459 // IE does not return inline styles via getAttribute(). See #2947. -
_source/plugins/forms/plugin.js
275 275 return !!this.$.checked; 276 276 case 'value' : 277 277 var type = this.getAttribute( 'type' ); 278 if ( type == 'checkbox' || type == 'radio' ) 279 return this.$.value != 'on'; 280 break; 281 default: 278 return type == 'checkbox' || type == 'radio' ? this.$.value != 'on' : this.$.value; 282 279 } 283 280 } 284 281 -
_source/plugins/forms/dialogs/button.js
1 /* 1 /* 2 2 Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved. 3 3 For licensing, see LICENSE.html or http://ckeditor.com/license 4 4 */ 5 5 CKEDITOR.dialog.add( 'button', function( editor ) 6 6 { 7 function commitAttributes( element ) 8 { 9 var val = this.getValue(); 10 if ( val ) 11 { 12 element.attributes[ this.id ] = val; 13 if ( this.id == 'name' ) 14 element.attributes[ 'data-cke-saved-name' ] = val; 15 } 16 else 17 { 18 delete element.attributes[ this.id ]; 19 if ( this.id == 'name' ) 20 delete element.attributes[ 'data-cke-saved-name' ]; 21 } 22 } 23 7 24 return { 8 25 title : editor.lang.button.title, 9 26 minWidth : 350, … … 24 41 }, 25 42 onOk : function() 26 43 { 27 var editor ,44 var editor = this.getParentEditor(), 28 45 element = this.button, 29 46 isInsertMode = !element; 30 47 48 var fake = element ? CKEDITOR.htmlParser.fragment.fromHtml( element.getOuterHtml() ).children[ 0 ] 49 : new CKEDITOR.htmlParser.element( 'input' ); 50 this.commitContent( fake ); 51 52 var writer = new CKEDITOR.htmlParser.basicWriter(); 53 fake.writeHtml( writer ); 54 var newElement = CKEDITOR.dom.element.createFromHtml( writer.getHtml(), editor.document ); 55 31 56 if ( isInsertMode ) 57 editor.insertElement( newElement ); 58 else 32 59 { 33 editor = this.getParentEditor();34 e lement = editor.document.createElement( 'input');60 newElement.replace( element ); 61 editor.getSelection().selectElement( newElement ); 35 62 } 36 37 if ( isInsertMode )38 editor.insertElement( element );39 this.commitContent( { element : element } );40 63 }, 41 64 contents : [ 42 65 { … … 45 68 title : editor.lang.button.title, 46 69 elements : [ 47 70 { 48 id : ' _cke_saved_name',71 id : 'name', 49 72 type : 'text', 50 73 label : editor.lang.common.name, 51 74 'default' : '', … … 56 79 element.getAttribute( 'name' ) || 57 80 '' ); 58 81 }, 59 commit : function( data ) 60 { 61 var element = data.element; 62 63 if ( this.getValue() ) 64 element.data( 'cke-saved-name', this.getValue() ); 65 else 66 { 67 element.data( 'cke-saved-name', false ); 68 element.removeAttribute( 'name' ); 69 } 70 } 82 commit : commitAttributes 71 83 }, 72 84 { 73 85 id : 'value', … … 79 91 { 80 92 this.setValue( element.getAttribute( 'value' ) || '' ); 81 93 }, 82 commit : function( data ) 83 { 84 var element = data.element; 85 86 if ( this.getValue() ) 87 element.setAttribute( 'value', this.getValue() ); 88 else 89 element.removeAttribute( 'value' ); 90 } 94 commit : commitAttributes 91 95 }, 92 96 { 93 97 id : 'type', … … 105 109 { 106 110 this.setValue( element.getAttribute( 'type' ) || '' ); 107 111 }, 108 commit : function( data ) 109 { 110 var element = data.element; 111 112 if ( CKEDITOR.env.ie ) 113 { 114 var elementType = element.getAttribute( 'type' ); 115 var currentType = this.getValue(); 116 117 if ( currentType != elementType ) 118 { 119 var replace = CKEDITOR.dom.element.createFromHtml( '<input type="' + currentType + 120 '"></input>', editor.document ); 121 element.copyAttributes( replace, { type : 1 } ); 122 replace.replace( element ); 123 editor.getSelection().selectElement( replace ); 124 data.element = replace; 125 } 126 } 127 else 128 element.setAttribute( 'type', this.getValue() ); 129 } 130 } 112 commit : commitAttributes 113 } 131 114 ] 132 115 } 133 116 ]