Built motion from commit de2cb856.|2.0.35
[motion2.git] / public / assets / plugins / ckeditor / plugins / iframe / dialogs / iframe.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 (function() {
6     function c(b) {
7         var c = this instanceof CKEDITOR.ui.dialog.checkbox;
8         b.hasAttribute(this.id) && (b = b.getAttribute(this.id), c ? this.setValue(e[this.id]["true"] == b.toLowerCase()) : this.setValue(b))
9     }
10
11     function d(b) {
12         var c = "" === this.getValue(),
13             a = this instanceof CKEDITOR.ui.dialog.checkbox,
14             d = this.getValue();
15         c ? b.removeAttribute(this.att || this.id) : a ? b.setAttribute(this.id, e[this.id][d]) : b.setAttribute(this.att || this.id, d)
16     }
17     var e = {
18         scrolling: {
19             "true": "yes",
20             "false": "no"
21         },
22         frameborder: {
23             "true": "1",
24             "false": "0"
25         }
26     };
27     CKEDITOR.dialog.add("iframe", function(b) {
28         var f = b.lang.iframe,
29             a = b.lang.common,
30             e = b.plugins.dialogadvtab;
31         return {
32             title: f.title,
33             minWidth: 350,
34             minHeight: 260,
35             onShow: function() {
36                 this.fakeImage = this.iframeNode = null;
37                 var a = this.getSelectedElement();
38                 a && a.data("cke-real-element-type") && "iframe" == a.data("cke-real-element-type") && (this.fakeImage = a, this.iframeNode = a = b.restoreRealElement(a), this.setupContent(a))
39             },
40             onOk: function() {
41                 var a;
42                 a = this.fakeImage ? this.iframeNode : new CKEDITOR.dom.element("iframe");
43                 var c = {},
44                     d = {};
45                 this.commitContent(a, c, d);
46                 a = b.createFakeElement(a, "cke_iframe", "iframe", !0);
47                 a.setAttributes(d);
48                 a.setStyles(c);
49                 this.fakeImage ? (a.replace(this.fakeImage), b.getSelection().selectElement(a)) : b.insertElement(a)
50             },
51             contents: [{
52                 id: "info",
53                 label: a.generalTab,
54                 accessKey: "I",
55                 elements: [{
56                     type: "vbox",
57                     padding: 0,
58                     children: [{
59                         id: "src",
60                         type: "text",
61                         label: a.url,
62                         required: !0,
63                         validate: CKEDITOR.dialog.validate.notEmpty(f.noUrl),
64                         setup: c,
65                         commit: d
66                     }]
67                 }, {
68                     type: "hbox",
69                     children: [{
70                         id: "width",
71                         type: "text",
72                         requiredContent: "iframe[width]",
73                         style: "width:100%",
74                         labelLayout: "vertical",
75                         label: a.width,
76                         validate: CKEDITOR.dialog.validate.htmlLength(a.invalidHtmlLength.replace("%1", a.width)),
77                         setup: c,
78                         commit: d
79                     }, {
80                         id: "height",
81                         type: "text",
82                         requiredContent: "iframe[height]",
83                         style: "width:100%",
84                         labelLayout: "vertical",
85                         label: a.height,
86                         validate: CKEDITOR.dialog.validate.htmlLength(a.invalidHtmlLength.replace("%1", a.height)),
87                         setup: c,
88                         commit: d
89                     }, {
90                         id: "align",
91                         type: "select",
92                         requiredContent: "iframe[align]",
93                         "default": "",
94                         items: [
95                             [a.notSet, ""],
96                             [a.alignLeft, "left"],
97                             [a.alignRight,
98                                 "right"
99                             ],
100                             [a.alignTop, "top"],
101                             [a.alignMiddle, "middle"],
102                             [a.alignBottom, "bottom"]
103                         ],
104                         style: "width:100%",
105                         labelLayout: "vertical",
106                         label: a.align,
107                         setup: function(a, b) {
108                             c.apply(this, arguments);
109                             if (b) {
110                                 var d = b.getAttribute("align");
111                                 this.setValue(d && d.toLowerCase() || "")
112                             }
113                         },
114                         commit: function(a, b, c) {
115                             d.apply(this, arguments);
116                             this.getValue() && (c.align = this.getValue())
117                         }
118                     }]
119                 }, {
120                     type: "hbox",
121                     widths: ["50%", "50%"],
122                     children: [{
123                         id: "scrolling",
124                         type: "checkbox",
125                         requiredContent: "iframe[scrolling]",
126                         label: f.scrolling,
127                         setup: c,
128                         commit: d
129                     }, {
130                         id: "frameborder",
131                         type: "checkbox",
132                         requiredContent: "iframe[frameborder]",
133                         label: f.border,
134                         setup: c,
135                         commit: d
136                     }]
137                 }, {
138                     type: "hbox",
139                     widths: ["50%", "50%"],
140                     children: [{
141                         id: "name",
142                         type: "text",
143                         requiredContent: "iframe[name]",
144                         label: a.name,
145                         setup: c,
146                         commit: d
147                     }, {
148                         id: "title",
149                         type: "text",
150                         requiredContent: "iframe[title]",
151                         label: a.advisoryTitle,
152                         setup: c,
153                         commit: d
154                     }]
155                 }, {
156                     id: "longdesc",
157                     type: "text",
158                     requiredContent: "iframe[longdesc]",
159                     label: a.longDescr,
160                     setup: c,
161                     commit: d
162                 }]
163             }, e && e.createAdvancedTab(b, {
164                 id: 1,
165                 classes: 1,
166                 styles: 1
167             }, "iframe")]
168         }
169     })
170 })();