Built motion from commit 67e5df37.|2.0.66
[motion2.git] / public / assets / plugins / ckeditor / plugins / forms / dialogs / button.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("button", function(b) {
6     function d(a) {
7         var b = this.getValue();
8         b ? (a.attributes[this.id] = b, "name" == this.id && (a.attributes["data-cke-saved-name"] = b)) : (delete a.attributes[this.id], "name" == this.id && delete a.attributes["data-cke-saved-name"])
9     }
10     return {
11         title: b.lang.forms.button.title,
12         minWidth: 350,
13         minHeight: 150,
14         onShow: function() {
15             delete this.button;
16             var a = this.getParentEditor().getSelection().getSelectedElement();
17             a && a.is("input") && a.getAttribute("type") in {
18                 button: 1,
19                 reset: 1,
20                 submit: 1
21             } && (this.button =
22                 a, this.setupContent(a))
23         },
24         onOk: function() {
25             var a = this.getParentEditor(),
26                 b = this.button,
27                 d = !b,
28                 c = b ? CKEDITOR.htmlParser.fragment.fromHtml(b.getOuterHtml()).children[0] : new CKEDITOR.htmlParser.element("input");
29             this.commitContent(c);
30             var e = new CKEDITOR.htmlParser.basicWriter;
31             c.writeHtml(e);
32             c = CKEDITOR.dom.element.createFromHtml(e.getHtml(), a.document);
33             d ? a.insertElement(c) : (c.replace(b), a.getSelection().selectElement(c))
34         },
35         contents: [{
36             id: "info",
37             label: b.lang.forms.button.title,
38             title: b.lang.forms.button.title,
39             elements: [{
40                 id: "name",
41                 type: "text",
42                 bidi: !0,
43                 label: b.lang.common.name,
44                 "default": "",
45                 setup: function(a) {
46                     this.setValue(a.data("cke-saved-name") || a.getAttribute("name") || "")
47                 },
48                 commit: d
49             }, {
50                 id: "value",
51                 type: "text",
52                 label: b.lang.forms.button.text,
53                 accessKey: "V",
54                 "default": "",
55                 setup: function(a) {
56                     this.setValue(a.getAttribute("value") || "")
57                 },
58                 commit: d
59             }, {
60                 id: "type",
61                 type: "select",
62                 label: b.lang.forms.button.type,
63                 "default": "button",
64                 accessKey: "T",
65                 items: [
66                     [b.lang.forms.button.typeBtn, "button"],
67                     [b.lang.forms.button.typeSbm, "submit"],
68                     [b.lang.forms.button.typeRst,
69                         "reset"
70                     ]
71                 ],
72                 setup: function(a) {
73                     this.setValue(a.getAttribute("type") || "")
74                 },
75                 commit: d
76             }]
77         }]
78     }
79 });