ce63239b6d836051348ea473885c99eb730f8dd3
2 Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
3 For licensing, see LICENSE.html or http://ckeditor.com/license
5 CKEDITOR
.dialog
.add( 'hiddenfield', function( editor
)
8 title
: editor
.lang
.hidden
.title
,
14 delete this.hiddenField
;
16 var editor
= this.getParentEditor(),
17 selection
= editor
.getSelection(),
18 element
= selection
.getSelectedElement();
20 if ( element
&& element
.data( 'cke-real-element-type' ) && element
.data( 'cke-real-element-type' ) == 'hiddenfield' )
22 this.hiddenField
= element
;
23 element
= editor
.restoreRealElement( this.hiddenField
);
24 this.setupContent( element
);
25 selection
.selectElement( this.hiddenField
);
30 var name
= this.getValueOf( 'info', '_cke_saved_name' ),
31 value
= this.getValueOf( 'info', 'value' ),
32 editor
= this.getParentEditor(),
33 element
= CKEDITOR
.env
.ie
&& !( CKEDITOR
.document
.$.documentMode
>= 8 ) ?
34 editor
.document
.createElement( '<input name="' + CKEDITOR
.tools
.htmlEncode( name
) + '">' )
35 : editor
.document
.createElement( 'input' );
37 element
.setAttribute( 'type', 'hidden' );
38 this.commitContent( element
);
39 var fakeElement
= editor
.createFakeElement( element
, 'cke_hidden', 'hiddenfield' );
40 if ( !this.hiddenField
)
41 editor
.insertElement( fakeElement
);
44 fakeElement
.replace( this.hiddenField
);
45 editor
.getSelection().selectElement( fakeElement
);
52 label
: editor
.lang
.hidden
.title
,
53 title
: editor
.lang
.hidden
.title
,
56 id
: '_cke_saved_name',
58 label
: editor
.lang
.hidden
.name
,
61 setup : function( element
)
64 element
.data( 'cke-saved-name' ) ||
65 element
.getAttribute( 'name' ) ||
68 commit : function( element
)
70 if ( this.getValue() )
71 element
.setAttribute( 'name', this.getValue() );
74 element
.removeAttribute( 'name' );
81 label
: editor
.lang
.hidden
.value
,
84 setup : function( element
)
86 this.setValue( element
.getAttribute( 'value' ) || '' );
88 commit : function( element
)
90 if ( this.getValue() )
91 element
.setAttribute( 'value', this.getValue() );
93 element
.removeAttribute( 'value' );