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("radio", function(b) {
7 title: b.lang.forms.checkboxAndRadio.radioTitle,
11 delete this.radioButton;
12 var a = this.getParentEditor().getSelection().getSelectedElement();
13 a && "input" == a.getName() && "radio" == a.getAttribute("type") && (this.radioButton = a, this.setupContent(a))
16 var a, c = this.radioButton,
18 b && (a = this.getParentEditor(), c = a.document.createElement("input"), c.setAttribute("type", "radio"));
19 b && a.insertElement(c);
26 label: b.lang.forms.checkboxAndRadio.radioTitle,
27 title: b.lang.forms.checkboxAndRadio.radioTitle,
31 label: b.lang.common.name,
35 this.setValue(a.data("cke-saved-name") || a.getAttribute("name") || "")
39 this.getValue() ? a.data("cke-saved-name", this.getValue()) : (a.data("cke-saved-name", !1), a.removeAttribute("name"))
44 label: b.lang.forms.checkboxAndRadio.value,
48 this.setValue(a.getAttribute("value") || "")
52 this.getValue() ? a.setAttribute("value", this.getValue()) : a.removeAttribute("value")
57 label: b.lang.forms.checkboxAndRadio.selected,
62 this.setValue(a.getAttribute("checked"))
66 if (CKEDITOR.env.ie) {
67 var d = c.getAttribute("checked"),
68 e = !!this.getValue();
69 d != e && (d = CKEDITOR.dom.element.createFromHtml('\x3cinput type\x3d"radio"' +
70 (e ? ' checked\x3d"checked"' : "") + "\x3e\x3c/input\x3e", b.document), c.copyAttributes(d, {
73 }), d.replace(c), b.getSelection().selectElement(d), a.element = d)
74 } else a = this.getValue(), CKEDITOR.env.webkit && (c.$.checked = a), a ? c.setAttribute("checked", "checked") : c.removeAttribute("checked")
79 label: b.lang.forms.checkboxAndRadio.required,
84 this.setValue(a.getAttribute("required"))
88 this.getValue() ? a.setAttribute("required", "required") : a.removeAttribute("required")