Built motion from commit de2cb856.|2.0.36
[motion2.git] / public / assets / plugins / ckeditor / plugins / forms / dialogs / radio.js
1 /*
2  Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved.
3  For licensing, see LICENSE.md or http://ckeditor.com/license
4 */
5 CKEDITOR.dialog.add("radio", function(b) {
6     return {
7         title: b.lang.forms.checkboxAndRadio.radioTitle,
8         minWidth: 350,
9         minHeight: 140,
10         onShow: function() {
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))
14         },
15         onOk: function() {
16             var a, c = this.radioButton,
17                 b = !c;
18             b && (a = this.getParentEditor(), c = a.document.createElement("input"), c.setAttribute("type", "radio"));
19             b && a.insertElement(c);
20             this.commitContent({
21                 element: c
22             })
23         },
24         contents: [{
25             id: "info",
26             label: b.lang.forms.checkboxAndRadio.radioTitle,
27             title: b.lang.forms.checkboxAndRadio.radioTitle,
28             elements: [{
29                 id: "name",
30                 type: "text",
31                 label: b.lang.common.name,
32                 "default": "",
33                 accessKey: "N",
34                 setup: function(a) {
35                     this.setValue(a.data("cke-saved-name") || a.getAttribute("name") || "")
36                 },
37                 commit: function(a) {
38                     a = a.element;
39                     this.getValue() ? a.data("cke-saved-name", this.getValue()) : (a.data("cke-saved-name", !1), a.removeAttribute("name"))
40                 }
41             }, {
42                 id: "value",
43                 type: "text",
44                 label: b.lang.forms.checkboxAndRadio.value,
45                 "default": "",
46                 accessKey: "V",
47                 setup: function(a) {
48                     this.setValue(a.getAttribute("value") || "")
49                 },
50                 commit: function(a) {
51                     a = a.element;
52                     this.getValue() ? a.setAttribute("value", this.getValue()) : a.removeAttribute("value")
53                 }
54             }, {
55                 id: "checked",
56                 type: "checkbox",
57                 label: b.lang.forms.checkboxAndRadio.selected,
58                 "default": "",
59                 accessKey: "S",
60                 value: "checked",
61                 setup: function(a) {
62                     this.setValue(a.getAttribute("checked"))
63                 },
64                 commit: function(a) {
65                     var c = a.element;
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, {
71                             type: 1,
72                             checked: 1
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")
75                 }
76             }, {
77                 id: "required",
78                 type: "checkbox",
79                 label: b.lang.forms.checkboxAndRadio.required,
80                 "default": "",
81                 accessKey: "Q",
82                 value: "required",
83                 setup: function(a) {
84                     this.setValue(a.getAttribute("required"))
85                 },
86                 commit: function(a) {
87                     a = a.element;
88                     this.getValue() ? a.setAttribute("required", "required") : a.removeAttribute("required")
89                 }
90             }]
91         }]
92     }
93 });