summaryrefslogtreecommitdiff
path: root/plugins/forms/dialogs/hiddenfield.js
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/forms/dialogs/hiddenfield.js')
-rwxr-xr-x[-rw-r--r--]plugins/forms/dialogs/hiddenfield.js93
1 files changed, 8 insertions, 85 deletions
diff --git a/plugins/forms/dialogs/hiddenfield.js b/plugins/forms/dialogs/hiddenfield.js
index 601a088..540ed42 100644..100755
--- a/plugins/forms/dialogs/hiddenfield.js
+++ b/plugins/forms/dialogs/hiddenfield.js
@@ -1,85 +1,8 @@
-/**
- * @license Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.
- * For licensing, see LICENSE.html or http://ckeditor.com/license
- */
-CKEDITOR.dialog.add( 'hiddenfield', function( editor ) {
- return {
- title: editor.lang.forms.hidden.title,
- hiddenField: null,
- minWidth: 350,
- minHeight: 110,
- onShow: function() {
- delete this.hiddenField;
-
- var editor = this.getParentEditor(),
- selection = editor.getSelection(),
- element = selection.getSelectedElement();
-
- if ( element && element.data( 'cke-real-element-type' ) && element.data( 'cke-real-element-type' ) == 'hiddenfield' ) {
- this.hiddenField = element;
- element = editor.restoreRealElement( this.hiddenField );
- this.setupContent( element );
- selection.selectElement( this.hiddenField );
- }
- },
- onOk: function() {
- var name = this.getValueOf( 'info', '_cke_saved_name' ),
- value = this.getValueOf( 'info', 'value' ),
- editor = this.getParentEditor(),
- element = CKEDITOR.env.ie && !( CKEDITOR.document.$.documentMode >= 8 ) ? editor.document.createElement( '<input name="' + CKEDITOR.tools.htmlEncode( name ) + '">' ) : editor.document.createElement( 'input' );
-
- element.setAttribute( 'type', 'hidden' );
- this.commitContent( element );
- var fakeElement = editor.createFakeElement( element, 'cke_hidden', 'hiddenfield' );
- if ( !this.hiddenField )
- editor.insertElement( fakeElement );
- else {
- fakeElement.replace( this.hiddenField );
- editor.getSelection().selectElement( fakeElement );
- }
- return true;
- },
- contents: [
- {
- id: 'info',
- label: editor.lang.forms.hidden.title,
- title: editor.lang.forms.hidden.title,
- elements: [
- {
- id: '_cke_saved_name',
- type: 'text',
- label: editor.lang.forms.hidden.name,
- 'default': '',
- accessKey: 'N',
- setup: function( element ) {
- this.setValue( element.data( 'cke-saved-name' ) || element.getAttribute( 'name' ) || '' );
- },
- commit: function( element ) {
- if ( this.getValue() )
- element.setAttribute( 'name', this.getValue() );
- else {
- element.removeAttribute( 'name' );
- }
- }
- },
- {
- id: 'value',
- type: 'text',
- label: editor.lang.forms.hidden.value,
- 'default': '',
- accessKey: 'V',
- setup: function( element ) {
- this.setValue( element.getAttribute( 'value' ) || '' );
- },
- commit: function( element ) {
- if ( this.getValue() )
- element.setAttribute( 'value', this.getValue() );
- else
- element.removeAttribute( 'value' );
- }
- }
- ]
- }
- ]
- };
-});
+/*
+ Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.
+ For licensing, see LICENSE.md or http://ckeditor.com/license
+*/
+CKEDITOR.dialog.add("hiddenfield",function(d){return{title:d.lang.forms.hidden.title,hiddenField:null,minWidth:350,minHeight:110,onShow:function(){delete this.hiddenField;var a=this.getParentEditor(),b=a.getSelection(),c=b.getSelectedElement();c&&(c.data("cke-real-element-type")&&"hiddenfield"==c.data("cke-real-element-type"))&&(this.hiddenField=c,c=a.restoreRealElement(this.hiddenField),this.setupContent(c),b.selectElement(this.hiddenField))},onOk:function(){var a=this.getValueOf("info","_cke_saved_name");
+this.getValueOf("info","value");var b=this.getParentEditor(),a=CKEDITOR.env.ie&&!(8<=CKEDITOR.document.$.documentMode)?b.document.createElement('<input name="'+CKEDITOR.tools.htmlEncode(a)+'">'):b.document.createElement("input");a.setAttribute("type","hidden");this.commitContent(a);a=b.createFakeElement(a,"cke_hidden","hiddenfield");this.hiddenField?(a.replace(this.hiddenField),b.getSelection().selectElement(a)):b.insertElement(a);return!0},contents:[{id:"info",label:d.lang.forms.hidden.title,title:d.lang.forms.hidden.title,
+elements:[{id:"_cke_saved_name",type:"text",label:d.lang.forms.hidden.name,"default":"",accessKey:"N",setup:function(a){this.setValue(a.data("cke-saved-name")||a.getAttribute("name")||"")},commit:function(a){this.getValue()?a.setAttribute("name",this.getValue()):a.removeAttribute("name")}},{id:"value",type:"text",label:d.lang.forms.hidden.value,"default":"",accessKey:"V",setup:function(a){this.setValue(a.getAttribute("value")||"")},commit:function(a){this.getValue()?a.setAttribute("value",this.getValue()):
+a.removeAttribute("value")}}]}]}}); \ No newline at end of file