2 Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved.
3 For licensing, see LICENSE.md or http://ckeditor.com/license
5 CKEDITOR.dialog.add("textfield", function(b) {
8 var b = this.getValue();
9 b ? a.setAttribute(this.id, b) : a.removeAttribute(this.id)
13 a = a.hasAttribute(this.id) && a.getAttribute(this.id);
14 this.setValue(a || "")
25 title: b.lang.forms.textfield.title,
29 delete this.textField;
30 var a = this.getParentEditor().getSelection().getSelectedElement();
31 !a || "input" != a.getName() || !g[a.getAttribute("type")] &&
32 a.getAttribute("type") || (this.textField = a, this.setupContent(a))
35 var a = this.getParentEditor(),
38 c && (b = a.document.createElement("input"), b.setAttribute("type", "text"));
42 c && a.insertElement(b.element);
43 this.commitContent(b);
44 c || a.getSelection().selectElement(b.element)
47 this.foreach(function(a) {
48 a.getValue && (a.setup || (a.setup = f), a.commit || (a.commit = e))
53 label: b.lang.forms.textfield.title,
54 title: b.lang.forms.textfield.title,
57 widths: ["50%", "50%"],
59 id: "_cke_saved_name",
61 label: b.lang.forms.textfield.name,
65 this.setValue(a.data("cke-saved-name") || a.getAttribute("name") || "")
69 this.getValue() ? a.data("cke-saved-name", this.getValue()) : (a.data("cke-saved-name", !1), a.removeAttribute("name"))
74 label: b.lang.forms.textfield.value,
78 if (CKEDITOR.env.ie &&
81 c = new CKEDITOR.dom.element("input", b.document);
87 } else e.call(this, a)
92 widths: ["50%", "50%"],
96 label: b.lang.forms.textfield.charWidth,
100 validate: CKEDITOR.dialog.validate.integer(b.lang.common.validateNumberFailed)
104 label: b.lang.forms.textfield.maxChars,
108 validate: CKEDITOR.dialog.validate.integer(b.lang.common.validateNumberFailed)
111 CKEDITOR.env.ie7Compat && this.getElement().setStyle("zoom", "100%")
116 label: b.lang.forms.textfield.type,
120 [b.lang.forms.textfield.typeEmail, "email"],
121 [b.lang.forms.textfield.typePass, "password"],
122 [b.lang.forms.textfield.typeSearch, "search"],
123 [b.lang.forms.textfield.typeTel, "tel"],
124 [b.lang.forms.textfield.typeText, "text"],
125 [b.lang.forms.textfield.typeUrl,
130 this.setValue(a.getAttribute("type"))
132 commit: function(a) {
134 if (CKEDITOR.env.ie) {
135 var c = d.getAttribute("type"),
137 c != e && (c = CKEDITOR.dom.element.createFromHtml('\x3cinput type\x3d"' + e + '"\x3e\x3c/input\x3e', b.document), d.copyAttributes(c, {
139 }), c.replace(d), a.element = c)
140 } else d.setAttribute("type", this.getValue())
145 label: b.lang.forms.textfield.required,
150 this.setValue(a.getAttribute("required"))
152 commit: function(a) {
154 this.getValue() ? a.setAttribute("required", "required") : a.removeAttribute("required")