Ticket #4056: 4056.patch
File 4056.patch, 5.1 KB (added by , 14 years ago) |
---|
-
_source/lang/en.js
679 679 680 680 fakeobjects : 681 681 { 682 anchor : 'Anchor', 683 flash : 'Flash Animation', 684 div : 'Page Break', 685 unknown : 'Unknown Object' 682 anchor : 'Anchor', 683 hiddenfield : 'Hidden', 684 flash : 'Flash Animation', 685 div : 'Page Break', 686 unknown : 'Unknown Object' 686 687 }, 687 688 688 689 resize : 'Drag to resize', -
_source/plugins/forms/dialogs/hiddenfield.js
6 6 { 7 7 return { 8 8 title : editor.lang.hidden.title, 9 hiddenField : null, 9 10 minWidth : 350, 10 11 minHeight : 110, 11 12 onShow : function() 12 13 { 13 14 delete this.hiddenField; 14 15 var element = this.getParentEditor().getSelection().getSelectedElement(); 16 if ( element && element.getName() == "input" && element.getAttribute( 'type' ) == "checkbox" ) 15 var editor = this.getParentEditor(), 16 selection = editor.getSelection(); 17 element = selection.getSelectedElement(); 18 19 if ( element && element.getAttribute( '_cke_real_element_type' ) && element.getAttribute( '_cke_real_element_type' ) == 'hiddenfield' ) 17 20 { 18 21 this.hiddenField = element; 19 this.setupContent( element ); 22 element = editor.restoreRealElement( this.hiddenField ); 23 24 this.setValueOf( 'info', '_cke_saved_name', element.getAttribute( 'name' ) || '' ); 25 this.setValueOf( 'info', 'value', element.getAttribute( 'value' ) || '' ); 26 27 selection.selectElement( this.hiddenField ); 20 28 } 29 21 30 }, 22 31 onOk : function() 23 32 { 24 var editor, 25 element = this.hiddenField, 26 isInsertMode = !element; 27 28 if ( isInsertMode ) 33 34 var name = this.getValueOf( 'info', '_cke_saved_name' ), 35 value = this.getValueOf( 'info', 'value' ), 36 editor = this.getParentEditor(), 37 element = CKEDITOR.env.ie ? 38 editor.document.createElement( '<input name="' + CKEDITOR.tools.htmlEncode( name ) + '">' ) : 39 editor.document.createElement( 'input' ); 40 41 if (this.hiddenField) { 42 this.hiddenField.copyAttributes( element, { name : 1 } ); 43 this.hiddenField.moveChildren( element ); 44 } 45 46 element.setAttribute( 'name', name ); 47 element.setAttribute( 'value', value ); 48 element.setAttribute( 'type', 'hidden'); 49 50 var fakeElement = editor.createFakeElement( element, 'cke_hidden', 'hiddenfield' ); 51 52 if ( !this.hiddenField ) 53 editor.insertElement( fakeElement ); 54 else 29 55 { 30 editor = this.getParentEditor(); 31 element = editor.document.createElement( 'input' ); 32 element.setAttribute( 'type', 'hidden' ); 56 fakeElement.replace( this.hiddenField ); 57 editor.getSelection().selectElement( fakeElement ); 33 58 } 34 35 if ( isInsertMode ) 36 editor.insertElement( element ); 37 this.commitContent( element ); 59 return true; 38 60 }, 39 61 contents : [ 40 62 { … … 47 69 type : 'text', 48 70 label : editor.lang.hidden.name, 49 71 'default' : '', 50 accessKey : 'N', 51 setup : function( element ) 52 { 53 this.setValue( 54 element.getAttribute( '_cke_saved_name' ) || 55 element.getAttribute( 'name' ) || 56 '' ); 57 }, 58 commit : function( element ) 59 { 60 if ( this.getValue() ) 61 element.setAttribute( '_cke_saved_name', this.getValue() ); 62 else 63 { 64 element.removeAttribute( '_cke_saved_name' ); 65 element.removeAttribute( 'name' ); 66 } 67 } 72 accessKey : 'N' 68 73 }, 69 74 { 70 75 id : 'value', 71 76 type : 'text', 72 77 label : editor.lang.hidden.value, 73 78 'default' : '', 74 accessKey : 'V', 75 setup : function( element ) 76 { 77 this.setValue( element.getAttribute( 'value' ) || '' ); 78 }, 79 commit : function( element ) 80 { 81 if ( this.getValue() ) 82 element.setAttribute( 'value', this.getValue() ); 83 else 84 element.removeAttribute( 'value' ); 85 } 79 accessKey : 'V' 86 80 } 87 81 ] 88 82 } -
_source/plugins/forms/plugin.js
19 19 'border: 1px dotted #FF0000;' + 20 20 'padding: 2px;' + 21 21 '}' ); 22 23 // Add the CSS styles for hiddenfield placeholders. 24 editor.addCss( 25 'img.cke_hidden' + 26 '{' + 27 'background-image: url(' + CKEDITOR.getUrl( this.path + 'images/hidden.gif' ) + ');' + 28 'background-position: center center;' + 29 'background-repeat: no-repeat;' + 30 'border: 1px solid #a9a9a9;' + 31 'width: 16px;' + 32 'height: 16px;' + 33 '}\n' ); 22 34 23 35 // All buttons use the same code to register. So, to avoid 24 36 // duplications, let's use this tool function.