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("checkbox", function(d) {
7 title: d.lang.forms.checkboxAndRadio.checkboxTitle,
12 var a = this.getParentEditor().getSelection().getSelectedElement();
13 a && "checkbox" == a.getAttribute("type") && (this.checkbox = a, this.setupContent(a))
16 var a, b = this.checkbox;
17 b || (a = this.getParentEditor(), b = a.document.createElement("input"), b.setAttribute("type", "checkbox"), a.insertElement(b));
24 label: d.lang.forms.checkboxAndRadio.checkboxTitle,
25 title: d.lang.forms.checkboxAndRadio.checkboxTitle,
26 startupFocus: "txtName",
30 label: d.lang.common.name,
34 this.setValue(a.data("cke-saved-name") || a.getAttribute("name") || "")
38 this.getValue() ? a.data("cke-saved-name", this.getValue()) : (a.data("cke-saved-name", !1), a.removeAttribute("name"))
43 label: d.lang.forms.checkboxAndRadio.value,
47 a = a.getAttribute("value");
48 this.setValue(CKEDITOR.env.ie && "on" == a ? "" : a)
53 !c || CKEDITOR.env.ie && "on" == c ? CKEDITOR.env.ie ? (c = new CKEDITOR.dom.element("input", b.getDocument()), b.copyAttributes(c, {
55 }), c.replace(b), d.getSelection().selectElement(c), a.element = c) : b.removeAttribute("value") : b.setAttribute("value", c)
60 label: d.lang.forms.checkboxAndRadio.selected,
65 this.setValue(a.getAttribute("checked"))
69 if (CKEDITOR.env.ie) {
70 var c = !!b.getAttribute("checked"),
71 e = !!this.getValue();
72 c != e && (c = CKEDITOR.dom.element.createFromHtml('\x3cinput type\x3d"checkbox"' + (e ? ' checked\x3d"checked"' : "") + "/\x3e", d.document), b.copyAttributes(c, {
75 }), c.replace(b), d.getSelection().selectElement(c), a.element = c)
76 } else a = this.getValue(), CKEDITOR.env.webkit && (b.$.checked = a), a ? b.setAttribute("checked",
77 "checked") : b.removeAttribute("checked")
82 label: d.lang.forms.checkboxAndRadio.required,
87 this.setValue(a.getAttribute("required"))
91 this.getValue() ? a.setAttribute("required", "required") : a.removeAttribute("required")