Built motion from commit c50d73b2.|2.0.46
[motion2.git] / public / assets / plugins / ckeditor / plugins / forms / dialogs / hiddenfield.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("hiddenfield", function(d) {
6     return {
7         title: d.lang.forms.hidden.title,
8         hiddenField: null,
9         minWidth: 350,
10         minHeight: 110,
11         onShow: function() {
12             delete this.hiddenField;
13             var a = this.getParentEditor(),
14                 b = a.getSelection(),
15                 c = b.getSelectedElement();
16             c && c.data("cke-real-element-type") && "hiddenfield" == c.data("cke-real-element-type") && (this.hiddenField = c, c = a.restoreRealElement(this.hiddenField), this.setupContent(c), b.selectElement(this.hiddenField))
17         },
18         onOk: function() {
19             var a = this.getValueOf("info", "_cke_saved_name"),
20                 b = this.getParentEditor(),
21                 a = CKEDITOR.env.ie && 8 > CKEDITOR.document.$.documentMode ? b.document.createElement('\x3cinput name\x3d"' + CKEDITOR.tools.htmlEncode(a) + '"\x3e') : b.document.createElement("input");
22             a.setAttribute("type", "hidden");
23             this.commitContent(a);
24             a = b.createFakeElement(a, "cke_hidden", "hiddenfield");
25             this.hiddenField ? (a.replace(this.hiddenField), b.getSelection().selectElement(a)) : b.insertElement(a);
26             return !0
27         },
28         contents: [{
29             id: "info",
30             label: d.lang.forms.hidden.title,
31             title: d.lang.forms.hidden.title,
32             elements: [{
33                 id: "_cke_saved_name",
34                 type: "text",
35                 label: d.lang.forms.hidden.name,
36                 "default": "",
37                 accessKey: "N",
38                 setup: function(a) {
39                     this.setValue(a.data("cke-saved-name") || a.getAttribute("name") || "")
40                 },
41                 commit: function(a) {
42                     this.getValue() ? a.setAttribute("name", this.getValue()) : a.removeAttribute("name")
43                 }
44             }, {
45                 id: "value",
46                 type: "text",
47                 label: d.lang.forms.hidden.value,
48                 "default": "",
49                 accessKey: "V",
50                 setup: function(a) {
51                     this.setValue(a.getAttribute("value") || "")
52                 },
53                 commit: function(a) {
54                     this.getValue() ? a.setAttribute("value", this.getValue()) : a.removeAttribute("value")
55                 }
56             }]
57         }]
58     }
59 });