namibia
df0489e1eeeeab5a9bd44e1d84fce49924fe1bac
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 |
/* Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.dialog.add( 'textfield', function( editor ) { var autoAttributes = { value : 1, size : 1, maxLength : 1 }; var acceptedTypes = { text : 1, password : 1 }; return { title : editor.lang.textfield.title, minWidth : 350, minHeight : 150, onShow : function() { delete this.textField; var element = this.getParentEditor().getSelection().getSelectedElement(); if ( element && element.getName() == "input" && ( acceptedTypes[ element.getAttribute( 'type' ) ] || !element.getAttribute( 'type' ) ) ) { this.textField = element; this.setupContent( element ); } }, onOk : function() { var editor, element = this.textField, isInsertMode = !element; if ( isInsertMode ) { editor = this.getParentEditor(); element = editor.document.createElement( 'input' ); element.setAttribute( 'type', 'text' ); } if ( isInsertMode ) editor.insertElement( element ); this.commitContent( { element : element } ); }, onLoad : function() { var autoSetup = function( element ) { var value = element.hasAttribute( this.id ) && element.getAttribute( this.id ); this.setValue( value || '' ); }; var autoCommit = function( data ) { var element = data.element; var value = this.getValue(); if ( value ) element.setAttribute( this.id, value ); else element.removeAttribute( this.id ); }; this.foreach( function( contentObj ) { if ( autoAttributes[ contentObj.id ] ) { contentObj.setup = autoSetup; contentObj.commit = autoCommit; } } ); }, contents : [ { id : 'info', label : editor.lang.textfield.title, title : editor.lang.textfield.title, elements : [ { type : 'hbox', widths : [ '50%', '50%' ], children : [ { id : '_cke_saved_name', type : 'text', label : editor.lang.textfield.name, 'default' : '', accessKey : 'N', setup : function( element ) { this.setValue( element.data( 'cke-saved-name' ) || element.getAttribute( 'name' ) || '' ); }, commit : function( data ) { var element = data.element; if ( this.getValue() ) element.data( 'cke-saved-name', this.getValue() ); else { element.data( 'cke-saved-name', false ); element.removeAttribute( 'name' ); } } }, { id : 'value', type : 'text', label : editor.lang.textfield.value, 'default' : '', accessKey : 'V' } ] }, { type : 'hbox', widths : [ '50%', '50%' ], children : [ { id : 'size', type : 'text', label : editor.lang.textfield.charWidth, 'default' : '', accessKey : 'C', style : 'width:50px', validate : CKEDITOR.dialog.validate.integer( editor.lang.common.validateNumberFailed ) }, { id : 'maxLength', type : 'text', label : editor.lang.textfield.maxChars, 'default' : '', accessKey : 'M', style : 'width:50px', validate : CKEDITOR.dialog.validate.integer( editor.lang.common.validateNumberFailed ) } ], onLoad : function() { // Repaint the style for IE7 (#6068) if ( CKEDITOR.env.ie7Compat ) this.getElement().setStyle( 'zoom', '100%' ); } }, { id : 'type', type : 'select', label : editor.lang.textfield.type, 'default' : 'text', accessKey : 'M', items : [ [ editor.lang.textfield.typeText, 'text' ], [ editor.lang.textfield.typePass, 'password' ] ], setup : function( element ) { this.setValue( element.getAttribute( 'type' ) ); }, commit : function( data ) { var element = data.element; if ( CKEDITOR.env.ie ) { var elementType = element.getAttribute( 'type' ); var myType = this.getValue(); if ( elementType != myType ) { var replace = CKEDITOR.dom.element.createFromHtml( '<input type="' + myType + '"></input>', editor.document ); element.copyAttributes( replace, { type : 1 } ); replace.replace( element ); editor.getSelection().selectElement( replace ); data.element = replace; } } else element.setAttribute( 'type', this.getValue() ); } } ] } ] }; }); |
Commits for namibiapublic/scripts/ckeditor/_source/plugins/forms/dialogs/textfield.js
Revision | Author | Commited | Message |
---|---|---|---|
df0489 ... | Mark | Fri 14 Oct, 2016 10:01:00 +0000 | initial commit |