Browse code

Update tinyMCE 4 to 4.5.12 due to security issues with 4.5.3 - README.md updated as a result

Clarissa Walker authored on 2026/07/28 07:48:13
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,1421 @@
1
+(function () {
2
+
3
+var defs = {}; // id -> {dependencies, definition, instance (possibly undefined)}
4
+
5
+// Used when there is no 'main' module.
6
+// The name is probably (hopefully) unique so minification removes for releases.
7
+var register_3795 = function (id) {
8
+  var module = dem(id);
9
+  var fragments = id.split('.');
10
+  var target = Function('return this;')();
11
+  for (var i = 0; i < fragments.length - 1; ++i) {
12
+    if (target[fragments[i]] === undefined)
13
+      target[fragments[i]] = {};
14
+    target = target[fragments[i]];
15
+  }
16
+  target[fragments[fragments.length - 1]] = module;
17
+};
18
+
19
+var instantiate = function (id) {
20
+  var actual = defs[id];
21
+  var dependencies = actual.deps;
22
+  var definition = actual.defn;
23
+  var len = dependencies.length;
24
+  var instances = new Array(len);
25
+  for (var i = 0; i < len; ++i)
26
+    instances[i] = dem(dependencies[i]);
27
+  var defResult = definition.apply(null, instances);
28
+  if (defResult === undefined)
29
+     throw 'module [' + id + '] returned undefined';
30
+  actual.instance = defResult;
31
+};
32
+
33
+var def = function (id, dependencies, definition) {
34
+  if (typeof id !== 'string')
35
+    throw 'module id must be a string';
36
+  else if (dependencies === undefined)
37
+    throw 'no dependencies for ' + id;
38
+  else if (definition === undefined)
39
+    throw 'no definition function for ' + id;
40
+  defs[id] = {
41
+    deps: dependencies,
42
+    defn: definition,
43
+    instance: undefined
44
+  };
45
+};
46
+
47
+var dem = function (id) {
48
+  var actual = defs[id];
49
+  if (actual === undefined)
50
+    throw 'module [' + id + '] was undefined';
51
+  else if (actual.instance === undefined)
52
+    instantiate(id);
53
+  return actual.instance;
54
+};
55
+
56
+var req = function (ids, callback) {
57
+  var len = ids.length;
58
+  var instances = new Array(len);
59
+  for (var i = 0; i < len; ++i)
60
+    instances[i] = dem(ids[i]);
61
+  callback.apply(null, instances);
62
+};
63
+
64
+var ephox = {};
65
+
66
+ephox.bolt = {
67
+  module: {
68
+    api: {
69
+      define: def,
70
+      require: req,
71
+      demand: dem
72
+    }
73
+  }
74
+};
75
+
76
+var define = def;
77
+var require = req;
78
+var demand = dem;
79
+// this helps with minification when using a lot of global references
80
+var defineGlobal = function (id, ref) {
81
+  define(id, [], function () { return ref; });
82
+};
83
+/*jsc
84
+["tinymce.media.Plugin","global!tinymce.PluginManager","tinymce.media.ui.Dialog","tinymce.media.core.Sanitize","tinymce.media.core.UpdateHtml","tinymce.media.core.Nodes","global!tinymce.util.Delay","tinymce.media.core.HtmlToData","global!tinymce.html.Writer","global!tinymce.html.SaxParser","global!tinymce.html.Schema","global!tinymce.dom.DOMUtils.DOM","tinymce.media.core.Size","tinymce.media.core.Service","global!tinymce.util.Tools","global!tinymce.Env","tinymce.media.ui.SizeManager","tinymce.media.core.VideoScript","global!tinymce.html.Node","tinymce.media.core.DataToHtml","global!tinymce.util.Promise","tinymce.media.core.Mime","tinymce.media.core.UrlPatterns"]
85
+jsc*/
86
+defineGlobal("global!tinymce.PluginManager", tinymce.PluginManager);
87
+defineGlobal("global!tinymce.util.Delay", tinymce.util.Delay);
88
+defineGlobal("global!tinymce.util.Tools", tinymce.util.Tools);
89
+defineGlobal("global!tinymce.html.SaxParser", tinymce.html.SaxParser);
90
+defineGlobal("global!tinymce.html.Schema", tinymce.html.Schema);
91
+defineGlobal("global!tinymce.dom.DOMUtils.DOM", tinymce.dom.DOMUtils.DOM);
92
+define('tinymce.media.core.VideoScript', [
93
+], function () {
94
+	var getVideoScriptMatch = function (prefixes, src) {
95
+		// var prefixes = editor.settings.media_scripts;
96
+
97
+		if (prefixes) {
98
+			for (var i = 0; i < prefixes.length; i++) {
99
+				if (src.indexOf(prefixes[i].filter) !== -1) {
100
+					return prefixes[i];
101
+				}
102
+			}
103
+		}
104
+	};
105
+
106
+	return {
107
+		getVideoScriptMatch: getVideoScriptMatch
108
+	};
109
+});
110
+define('tinymce.media.core.Size', [
111
+], function () {
112
+	var trimPx = function (value) {
113
+		return value.replace(/px$/, '');
114
+	};
115
+
116
+	var addPx = function (value) {
117
+		return /^[0-9.]+$/.test(value) ? (value + 'px') : value;
118
+	};
119
+
120
+	var getSize = function (name) {
121
+		return function (elm) {
122
+			return elm ? trimPx(elm.style[name]) : '';
123
+		};
124
+	};
125
+
126
+	var setSize = function (name) {
127
+		return function (elm, value) {
128
+			if (elm) {
129
+				elm.style[name] = addPx(value);
130
+			}
131
+		};
132
+	};
133
+
134
+	return {
135
+		getMaxWidth: getSize('maxWidth'),
136
+		getMaxHeight: getSize('maxHeight'),
137
+		setMaxWidth: setSize('maxWidth'),
138
+		setMaxHeight: setSize('maxHeight')
139
+	};
140
+});
141
+define('tinymce.media.core.HtmlToData', [
142
+	'global!tinymce.util.Tools',
143
+	'global!tinymce.html.SaxParser',
144
+	'global!tinymce.html.Schema',
145
+	'global!tinymce.dom.DOMUtils.DOM',
146
+	'tinymce.media.core.VideoScript',
147
+	'tinymce.media.core.Size'
148
+], function (Tools, SaxParser, Schema, DOM, VideoScript, Size) {
149
+	var getEphoxEmbedIri = function (elm) {
150
+		return DOM.getAttrib(elm, 'data-ephox-embed-iri');
151
+	};
152
+
153
+	var isEphoxEmbed = function (html) {
154
+		var fragment = DOM.createFragment(html);
155
+		return getEphoxEmbedIri(fragment.firstChild) !== '';
156
+	};
157
+
158
+	var htmlToDataSax = function (prefixes, html) {
159
+		var data = {};
160
+
161
+		new SaxParser({
162
+			validate: false,
163
+			allow_conditional_comments: true,
164
+			special: 'script,noscript',
165
+			start: function (name, attrs) {
166
+				if (!data.source1 && name === "param") {
167
+					data.source1 = attrs.map.movie;
168
+				}
169
+
170
+				if (name === "iframe" || name === "object" || name === "embed" || name === "video" || name === "audio") {
171
+					if (!data.type) {
172
+						data.type = name;
173
+					}
174
+
175
+					data = Tools.extend(attrs.map, data);
176
+				}
177
+
178
+				if (name === "script") {
179
+					var videoScript = VideoScript.getVideoScriptMatch(prefixes, attrs.map.src);
180
+					if (!videoScript) {
181
+						return;
182
+					}
183
+
184
+					data = {
185
+						type: "script",
186
+						source1: attrs.map.src,
187
+						width: videoScript.width,
188
+						height: videoScript.height
189
+					};
190
+				}
191
+
192
+				if (name === "source") {
193
+					if (!data.source1) {
194
+						data.source1 = attrs.map.src;
195
+					} else if (!data.source2) {
196
+						data.source2 = attrs.map.src;
197
+					}
198
+				}
199
+
200
+				if (name === "img" && !data.poster) {
201
+					data.poster = attrs.map.src;
202
+				}
203
+			}
204
+		}).parse(html);
205
+
206
+		data.source1 = data.source1 || data.src || data.data;
207
+		data.source2 = data.source2 || '';
208
+		data.poster = data.poster || '';
209
+
210
+		return data;
211
+	};
212
+
213
+	var ephoxEmbedHtmlToData = function (html) {
214
+		var fragment = DOM.createFragment(html);
215
+		var div = fragment.firstChild;
216
+
217
+		return {
218
+			type: 'ephox-embed-iri',
219
+			source1: getEphoxEmbedIri(div),
220
+			source2: '',
221
+			poster: '',
222
+			width: Size.getMaxWidth(div),
223
+			height: Size.getMaxHeight(div)
224
+		};
225
+	};
226
+
227
+	var htmlToData = function (prefixes, html) {
228
+		return isEphoxEmbed(html) ? ephoxEmbedHtmlToData(html) : htmlToDataSax(prefixes, html);
229
+	};
230
+
231
+	return {
232
+		htmlToData: htmlToData
233
+	};
234
+});
235
+defineGlobal("global!tinymce.html.Writer", tinymce.html.Writer);
236
+define('tinymce.media.core.UpdateHtml', [
237
+	'global!tinymce.html.Writer',
238
+	'global!tinymce.html.SaxParser',
239
+	'global!tinymce.html.Schema',
240
+	'global!tinymce.dom.DOMUtils.DOM',
241
+	'tinymce.media.core.Size'
242
+], function (Writer, SaxParser, Schema, DOM, Size) {
243
+	var setAttributes = function (attrs, updatedAttrs) {
244
+		var name;
245
+		var i;
246
+		var value;
247
+		var attr;
248
+
249
+		for (name in updatedAttrs) {
250
+			value = "" + updatedAttrs[name];
251
+
252
+			if (attrs.map[name]) {
253
+				i = attrs.length;
254
+				while (i--) {
255
+					attr = attrs[i];
256
+
257
+					if (attr.name === name) {
258
+						if (value) {
259
+							attrs.map[name] = value;
260
+							attr.value = value;
261
+						} else {
262
+							delete attrs.map[name];
263
+							attrs.splice(i, 1);
264
+						}
265
+					}
266
+				}
267
+			} else if (value) {
268
+				attrs.push({
269
+					name: name,
270
+					value: value
271
+				});
272
+
273
+				attrs.map[name] = value;
274
+			}
275
+		}
276
+	};
277
+
278
+	var normalizeHtml = function (html) {
279
+		var writer = new Writer();
280
+		var parser = new SaxParser(writer);
281
+		parser.parse(html);
282
+		return writer.getContent();
283
+	};
284
+
285
+	var updateHtmlSax = function (html, data, updateAll) {
286
+		var writer = new Writer();
287
+		var sourceCount = 0;
288
+		var hasImage;
289
+
290
+		new SaxParser({
291
+			validate: false,
292
+			allow_conditional_comments: true,
293
+			special: 'script,noscript',
294
+
295
+			comment: function (text) {
296
+				writer.comment(text);
297
+			},
298
+
299
+			cdata: function (text) {
300
+				writer.cdata(text);
301
+			},
302
+
303
+			text: function (text, raw) {
304
+				writer.text(text, raw);
305
+			},
306
+
307
+			start: function (name, attrs, empty) {
308
+				switch (name) {
309
+				case "video":
310
+				case "object":
311
+				case "embed":
312
+				case "img":
313
+				case "iframe":
314
+					setAttributes(attrs, {
315
+						width: data.width,
316
+						height: data.height
317
+					});
318
+					break;
319
+				}
320
+
321
+				if (updateAll) {
322
+					switch (name) {
323
+					case "video":
324
+						setAttributes(attrs, {
325
+							poster: data.poster,
326
+							src: ""
327
+						});
328
+
329
+						if (data.source2) {
330
+							setAttributes(attrs, {
331
+								src: ""
332
+							});
333
+						}
334
+						break;
335
+
336
+					case "iframe":
337
+						setAttributes(attrs, {
338
+							src: data.source1
339
+						});
340
+						break;
341
+
342
+					case "source":
343
+						sourceCount++;
344
+
345
+						if (sourceCount <= 2) {
346
+							setAttributes(attrs, {
347
+								src: data["source" + sourceCount],
348
+								type: data["source" + sourceCount + "mime"]
349
+							});
350
+
351
+							if (!data["source" + sourceCount]) {
352
+								return;
353
+							}
354
+						}
355
+						break;
356
+
357
+					case "img":
358
+						if (!data.poster) {
359
+							return;
360
+						}
361
+
362
+						hasImage = true;
363
+						break;
364
+					}
365
+				}
366
+
367
+				writer.start(name, attrs, empty);
368
+			},
369
+
370
+			end: function (name) {
371
+				if (name === "video" && updateAll) {
372
+					for (var index = 1; index <= 2; index++) {
373
+						if (data["source" + index]) {
374
+							var attrs = [];
375
+							attrs.map = {};
376
+
377
+							if (sourceCount < index) {
378
+								setAttributes(attrs, {
379
+									src: data["source" + index],
380
+									type: data["source" + index + "mime"]
381
+								});
382
+
383
+								writer.start("source", attrs, true);
384
+							}
385
+						}
386
+					}
387
+				}
388
+
389
+				if (data.poster && name === "object" && updateAll && !hasImage) {
390
+					var imgAttrs = [];
391
+					imgAttrs.map = {};
392
+
393
+					setAttributes(imgAttrs, {
394
+						src: data.poster,
395
+						width: data.width,
396
+						height: data.height
397
+					});
398
+
399
+					writer.start("img", imgAttrs, true);
400
+				}
401
+
402
+				writer.end(name);
403
+			}
404
+		}, new Schema({})).parse(html);
405
+
406
+		return writer.getContent();
407
+	};
408
+
409
+	var isEphoxEmbed = function (html) {
410
+		var fragment = DOM.createFragment(html);
411
+		return DOM.getAttrib(fragment.firstChild, 'data-ephox-embed-iri') !== '';
412
+	};
413
+
414
+	var updateEphoxEmbed = function (html, data) {
415
+		var fragment = DOM.createFragment(html);
416
+		var div = fragment.firstChild;
417
+
418
+		Size.setMaxWidth(div, data.width);
419
+		Size.setMaxHeight(div, data.height);
420
+
421
+		return normalizeHtml(div.outerHTML);
422
+	};
423
+
424
+	var updateHtml = function (html, data, updateAll) {
425
+		return isEphoxEmbed(html) ? updateEphoxEmbed(html, data) : updateHtmlSax(html, data, updateAll);
426
+	};
427
+
428
+	return {
429
+		updateHtml: updateHtml
430
+	};
431
+});
432
+define('tinymce.media.core.Mime', [
433
+], function () {
434
+	var guess = function (url) {
435
+		var mimes = {
436
+			'mp3': 'audio/mpeg',
437
+			'wav': 'audio/wav',
438
+			'mp4': 'video/mp4',
439
+			'webm': 'video/webm',
440
+			'ogg': 'video/ogg',
441
+			'swf': 'application/x-shockwave-flash'
442
+		};
443
+		var fileEnd = url.toLowerCase().split('.').pop();
444
+		var mime = mimes[fileEnd];
445
+
446
+		return mime ? mime : '';
447
+	};
448
+
449
+	return {
450
+		guess: guess
451
+	};
452
+});
453
+define('tinymce.media.core.UrlPatterns', [
454
+], function () {
455
+	var urlPatterns = [
456
+		{
457
+			regex: /youtu\.be\/([\w\-.]+)/,
458
+			type: 'iframe', w: 560, h: 314,
459
+			url: '//www.youtube.com/embed/$1',
460
+			allowFullscreen: true
461
+		},
462
+		{
463
+			regex: /youtube\.com(.+)v=([^&]+)/,
464
+			type: 'iframe', w: 560, h: 314,
465
+			url: '//www.youtube.com/embed/$2',
466
+			allowFullscreen: true
467
+		},
468
+		{
469
+			regex: /youtube.com\/embed\/([a-z0-9\-_]+(?:\?.+)?)/i,
470
+			type: 'iframe', w: 560, h: 314,
471
+			url: '//www.youtube.com/embed/$1',
472
+			allowFullscreen: true
473
+		},
474
+		{
475
+			regex: /vimeo\.com\/([0-9]+)/,
476
+			type: 'iframe', w: 425, h: 350,
477
+			url: '//player.vimeo.com/video/$1?title=0&byline=0&portrait=0&color=8dc7dc',
478
+			allowfullscreen: true
479
+		},
480
+		{
481
+			regex: /vimeo\.com\/(.*)\/([0-9]+)/,
482
+			type: "iframe", w: 425, h: 350,
483
+			url: "//player.vimeo.com/video/$2?title=0&amp;byline=0",
484
+			allowfullscreen: true
485
+		},
486
+		{
487
+			regex: /maps\.google\.([a-z]{2,3})\/maps\/(.+)msid=(.+)/,
488
+			type: 'iframe', w: 425, h: 350,
489
+			url: '//maps.google.com/maps/ms?msid=$2&output=embed"',
490
+			allowFullscreen: false
491
+		},
492
+		{
493
+			regex: /dailymotion\.com\/video\/([^_]+)/,
494
+			type: 'iframe', w: 480, h: 270,
495
+			url: '//www.dailymotion.com/embed/video/$1',
496
+			allowFullscreen: true
497
+		}
498
+	];
499
+
500
+	return {
501
+		urlPatterns: urlPatterns
502
+	};
503
+});
504
+define('tinymce.media.core.DataToHtml', [
505
+	'tinymce.media.core.Mime',
506
+	'tinymce.media.core.HtmlToData',
507
+	'tinymce.media.core.UrlPatterns',
508
+	'tinymce.media.core.VideoScript',
509
+	'tinymce.media.core.UpdateHtml',
510
+	'global!tinymce.util.Tools'
511
+], function (Mime, HtmlToData, UrlPatterns, VideoScript, UpdateHtml, Tools) {
512
+	var dataToHtml = function (editor, dataIn) {
513
+		var html = '';
514
+		var data = Tools.extend({}, dataIn);
515
+
516
+		if (!data.source1) {
517
+			Tools.extend(data, HtmlToData.htmlToData(editor.settings.media_scripts, data.embed));
518
+			if (!data.source1) {
519
+				return '';
520
+			}
521
+		}
522
+
523
+		if (!data.source2) {
524
+			data.source2 = '';
525
+		}
526
+
527
+		if (!data.poster) {
528
+			data.poster = '';
529
+		}
530
+
531
+		data.source1 = editor.convertURL(data.source1, "source");
532
+		data.source2 = editor.convertURL(data.source2, "source");
533
+		data.source1mime = Mime.guess(data.source1);
534
+		data.source2mime = Mime.guess(data.source2);
535
+		data.poster = editor.convertURL(data.poster, "poster");
536
+
537
+		Tools.each(UrlPatterns.urlPatterns, function (pattern) {
538
+			var i;
539
+			var url;
540
+
541
+			var match = pattern.regex.exec(data.source1);
542
+
543
+			if (match) {
544
+				url = pattern.url;
545
+
546
+				for (i = 0; match[i]; i++) {
547
+					/*jshint loopfunc:true*/
548
+					/*eslint no-loop-func:0 */
549
+					url = url.replace('$' + i, function () {
550
+						return match[i];
551
+					});
552
+				}
553
+
554
+				data.source1 = url;
555
+				data.type = pattern.type;
556
+				data.allowFullscreen = pattern.allowFullscreen;
557
+				data.width = data.width || pattern.w;
558
+				data.height = data.height || pattern.h;
559
+			}
560
+		});
561
+
562
+		if (data.embed) {
563
+			html = UpdateHtml.updateHtml(data.embed, data, true);
564
+		} else {
565
+			var videoScript = VideoScript.getVideoScriptMatch(editor.settings.media_scripts, data.source1);
566
+			if (videoScript) {
567
+				data.type = 'script';
568
+				data.width = videoScript.width;
569
+				data.height = videoScript.height;
570
+			}
571
+
572
+			data.width = data.width || 300;
573
+			data.height = data.height || 150;
574
+
575
+			Tools.each(data, function (value, key) {
576
+				data[key] = editor.dom.encode(value);
577
+			});
578
+
579
+			if (data.type === "iframe") {
580
+				var allowFullscreen = data.allowFullscreen ? ' allowFullscreen="1"' : '';
581
+				html +=
582
+					'<iframe src="' + data.source1 +
583
+					'" width="' + data.width +
584
+					'" height="' + data.height +
585
+					'"' + allowFullscreen + '></iframe>';
586
+			} else if (data.source1mime === "application/x-shockwave-flash") {
587
+				html +=
588
+					'<object data="' + data.source1 +
589
+					'" width="' + data.width +
590
+					'" height="' + data.height +
591
+					'" type="application/x-shockwave-flash">';
592
+
593
+				if (data.poster) {
594
+					html += '<img src="' + data.poster + '" width="' + data.width + '" height="' + data.height + '" />';
595
+				}
596
+
597
+				html += '</object>';
598
+			} else if (data.source1mime.indexOf('audio') !== -1) {
599
+				if (editor.settings.audio_template_callback) {
600
+					html = editor.settings.audio_template_callback(data);
601
+				} else {
602
+					html += (
603
+						'<audio controls="controls" src="' + data.source1 + '">' +
604
+							(
605
+								data.source2 ?
606
+									'\n<source src="' + data.source2 + '"' +
607
+										(data.source2mime ? ' type="' + data.source2mime + '"' : '') +
608
+									' />\n' : '') +
609
+						'</audio>'
610
+					);
611
+				}
612
+			} else if (data.type === "script") {
613
+				html += '<script src="' + data.source1 + '"></script>';
614
+			} else {
615
+				if (editor.settings.video_template_callback) {
616
+					html = editor.settings.video_template_callback(data);
617
+				} else {
618
+					html = (
619
+						'<video width="' + data.width +
620
+							'" height="' + data.height + '"' +
621
+								(data.poster ? ' poster="' + data.poster + '"' : '') + ' controls="controls">\n' +
622
+							'<source src="' + data.source1 + '"' +
623
+								(data.source1mime ? ' type="' + data.source1mime + '"' : '') + ' />\n' +
624
+							(data.source2 ? '<source src="' + data.source2 + '"' +
625
+								(data.source2mime ? ' type="' + data.source2mime + '"' : '') + ' />\n' : '') +
626
+						'</video>'
627
+					);
628
+				}
629
+			}
630
+		}
631
+
632
+		return html;
633
+	};
634
+
635
+	return {
636
+		dataToHtml: dataToHtml
637
+	};
638
+});
639
+defineGlobal("global!tinymce.util.Promise", tinymce.util.Promise);
640
+define('tinymce.media.core.Service', [
641
+	'tinymce.media.core.DataToHtml',
642
+	'global!tinymce.util.Promise'
643
+], function (DataToHtml, Promise) {
644
+
645
+	var embedPromise = function (data, dataToHtml, handler) {
646
+		var cache = {};
647
+		return new Promise(function (res, rej) {
648
+			var wrappedResolve = function (response) {
649
+				if (response.html) {
650
+					cache[data.source1] = response;
651
+				}
652
+				return res({
653
+					url: data.source1,
654
+					html: response.html ? response.html : dataToHtml(data)
655
+				});
656
+			};
657
+			if (cache[data.source1]) {
658
+				wrappedResolve(cache[data.source1]);
659
+			} else {
660
+				handler({url: data.source1}, wrappedResolve, rej);
661
+			}
662
+		});
663
+	};
664
+
665
+	var defaultPromise = function (data, dataToHtml) {
666
+		return new Promise(function (res) {
667
+			res({html: dataToHtml(data), url: data.source1});
668
+		});
669
+	};
670
+
671
+	var loadedData = function (editor) {
672
+		return function (data) {
673
+			return DataToHtml.dataToHtml(editor, data);
674
+		};
675
+	};
676
+
677
+	var getEmbedHtml = function (editor, data) {
678
+		var embedHandler = editor.settings.media_url_resolver;
679
+
680
+		return embedHandler ? embedPromise(data, loadedData(editor), embedHandler) : defaultPromise(data, loadedData(editor));
681
+	};
682
+
683
+	return {
684
+		getEmbedHtml: getEmbedHtml
685
+	};
686
+});
687
+defineGlobal("global!tinymce.Env", tinymce.Env);
688
+define('tinymce.media.ui.SizeManager', [
689
+], function () {
690
+	var doSyncSize = function (widthCtrl, heightCtrl) {
691
+		widthCtrl.state.set('oldVal', widthCtrl.value());
692
+		heightCtrl.state.set('oldVal', heightCtrl.value());
693
+	};
694
+	var doSizeControls = function (win, f) {
695
+		var widthCtrl = win.find('#width')[0];
696
+		var heightCtrl = win.find('#height')[0];
697
+		var constrained = win.find('#constrain')[0];
698
+		if (widthCtrl && heightCtrl && constrained) {
699
+			f(widthCtrl, heightCtrl, constrained.checked());
700
+		}
701
+	};
702
+
703
+	var doUpdateSize = function (widthCtrl, heightCtrl, isContrained) {
704
+		var oldWidth = widthCtrl.state.get('oldVal');
705
+		var oldHeight = heightCtrl.state.get('oldVal');
706
+		var newWidth = widthCtrl.value();
707
+		var newHeight = heightCtrl.value();
708
+
709
+		if (isContrained && oldWidth && oldHeight && newWidth && newHeight) {
710
+			if (newWidth !== oldWidth) {
711
+				newHeight = Math.round((newWidth / oldWidth) * newHeight);
712
+
713
+				if (!isNaN(newHeight)) {
714
+					heightCtrl.value(newHeight);
715
+				}
716
+			} else {
717
+				newWidth = Math.round((newHeight / oldHeight) * newWidth);
718
+
719
+				if (!isNaN(newWidth)) {
720
+					widthCtrl.value(newWidth);
721
+				}
722
+			}
723
+		}
724
+
725
+		doSyncSize(widthCtrl, heightCtrl);
726
+	};
727
+
728
+	var syncSize = function (win) {
729
+		doSizeControls(win, doSyncSize);
730
+	};
731
+
732
+	var updateSize = function (win) {
733
+		doSizeControls(win, doUpdateSize);
734
+	};
735
+
736
+	var createUi = function (onChange) {
737
+		var recalcSize = function () {
738
+			onChange(function (win) {
739
+				updateSize(win);
740
+			});
741
+		};
742
+
743
+		return {
744
+			type: 'container',
745
+			label: 'Dimensions',
746
+			layout: 'flex',
747
+			align: 'center',
748
+			spacing: 5,
749
+			items: [
750
+				{
751
+					name: 'width', type: 'textbox', maxLength: 5, size: 5,
752
+					onchange: recalcSize, ariaLabel: 'Width'
753
+				},
754
+				{type: 'label', text: 'x'},
755
+				{
756
+					name: 'height', type: 'textbox', maxLength: 5, size: 5,
757
+					onchange: recalcSize, ariaLabel: 'Height'
758
+				},
759
+				{name: 'constrain', type: 'checkbox', checked: true, text: 'Constrain proportions'}
760
+			]
761
+		};
762
+	};
763
+
764
+	return {
765
+		createUi: createUi,
766
+		syncSize: syncSize,
767
+		updateSize: updateSize
768
+	};
769
+});
770
+define('tinymce.media.ui.Dialog', [
771
+	'global!tinymce.util.Delay',
772
+	'tinymce.media.core.HtmlToData',
773
+	'tinymce.media.core.UpdateHtml',
774
+	'tinymce.media.core.Service',
775
+	'tinymce.media.core.Size',
776
+	'global!tinymce.util.Tools',
777
+	'global!tinymce.Env',
778
+	'tinymce.media.ui.SizeManager'
779
+], function (Delay, HtmlToData, UpdateHtml, Service, Size, Tools, Env, SizeManager) {
780
+	var embedChange = (Env.ie && Env.ie <= 8) ? 'onChange' : 'onInput';
781
+
782
+	var handleError = function (editor) {
783
+		return function (error) {
784
+			var errorMessage = error && error.msg ?
785
+				'Media embed handler error: ' + error.msg :
786
+				'Media embed handler threw unknown error.';
787
+			editor.notificationManager.open({type: 'error', text: errorMessage});
788
+		};
789
+	};
790
+
791
+	var getData = function (editor) {
792
+		var element = editor.selection.getNode();
793
+		var dataEmbed = element.getAttribute('data-ephox-embed-iri');
794
+
795
+		if (dataEmbed) {
796
+			return {
797
+				source1: dataEmbed,
798
+				'data-ephox-embed-iri': dataEmbed,
799
+				width: Size.getMaxWidth(element),
800
+				height: Size.getMaxHeight(element)
801
+			};
802
+		}
803
+
804
+		return element.getAttribute('data-mce-object') ?
805
+			HtmlToData.htmlToData(editor.settings.media_scripts, editor.serializer.serialize(element, {selection: true})) :
806
+			{};
807
+	};
808
+
809
+	var getSource = function (editor) {
810
+		var elm = editor.selection.getNode();
811
+
812
+		if (elm.getAttribute('data-mce-object') || elm.getAttribute('data-ephox-embed-iri')) {
813
+			return editor.selection.getContent();
814
+		}
815
+	};
816
+
817
+	var addEmbedHtml = function (win, editor) {
818
+		return function (response) {
819
+			var html = response.html;
820
+			var embed = win.find('#embed')[0];
821
+			var data = Tools.extend(HtmlToData.htmlToData(editor.settings.media_scripts, html), {source1: response.url});
822
+			win.fromJSON(data);
823
+
824
+			if (embed) {
825
+				embed.value(html);
826
+				SizeManager.updateSize(win);
827
+			}
828
+		};
829
+	};
830
+
831
+	var selectPlaceholder = function (editor, beforeObjects) {
832
+		var i;
833
+		var y;
834
+		var afterObjects = editor.dom.select('img[data-mce-object]');
835
+
836
+		// Find new image placeholder so we can select it
837
+		for (i = 0; i < beforeObjects.length; i++) {
838
+			for (y = afterObjects.length - 1; y >= 0; y--) {
839
+				if (beforeObjects[i] === afterObjects[y]) {
840
+					afterObjects.splice(y, 1);
841
+				}
842
+			}
843
+		}
844
+
845
+		editor.selection.select(afterObjects[0]);
846
+	};
847
+
848
+	var handleInsert = function (editor, html) {
849
+		var beforeObjects = editor.dom.select('img[data-mce-object]');
850
+
851
+		editor.insertContent(html);
852
+		selectPlaceholder(editor, beforeObjects);
853
+		editor.nodeChanged();
854
+	};
855
+
856
+	var submitForm = function (win, editor) {
857
+		var data = win.toJSON();
858
+
859
+		data.embed = UpdateHtml.updateHtml(data.embed, data);
860
+
861
+		if (data.embed) {
862
+			handleInsert(editor, data.embed);
863
+		} else {
864
+			Service.getEmbedHtml(editor, data)
865
+				.then(function (response) {
866
+					handleInsert(editor, response.html);
867
+				})["catch"](handleError(editor));
868
+		}
869
+	};
870
+
871
+	var populateMeta = function (win, meta) {
872
+		Tools.each(meta, function (value, key) {
873
+			win.find('#' + key).value(value);
874
+		});
875
+	};
876
+
877
+	var showDialog = function (editor) {
878
+		var win;
879
+		var data;
880
+
881
+		var generalFormItems = [
882
+			{
883
+				name: 'source1',
884
+				type: 'filepicker',
885
+				filetype: 'media',
886
+				size: 40,
887
+				autofocus: true,
888
+				label: 'Source',
889
+				onpaste: function () {
890
+					setTimeout(function () {
891
+						Service.getEmbedHtml(editor, win.toJSON())
892
+							.then(
893
+								addEmbedHtml(win, editor)
894
+							)["catch"](handleError(editor));
895
+					}, 1);
896
+				},
897
+				onchange: function (e) {
898
+					Service.getEmbedHtml(editor, win.toJSON())
899
+						.then(
900
+							addEmbedHtml(win, editor)
901
+						)["catch"](handleError(editor));
902
+
903
+					populateMeta(win, e.meta);
904
+				},
905
+				onbeforecall: function (e) {
906
+					e.meta = win.toJSON();
907
+				}
908
+			}
909
+		];
910
+
911
+		var advancedFormItems = [];
912
+
913
+		var reserialise = function (update) {
914
+			update(win);
915
+			data = win.toJSON();
916
+			win.find('#embed').value(UpdateHtml.updateHtml(data.embed, data));
917
+		};
918
+
919
+		if (editor.settings.media_alt_source !== false) {
920
+			advancedFormItems.push({name: 'source2', type: 'filepicker', filetype: 'media', size: 40, label: 'Alternative source'});
921
+		}
922
+
923
+		if (editor.settings.media_poster !== false) {
924
+			advancedFormItems.push({name: 'poster', type: 'filepicker', filetype: 'image', size: 40, label: 'Poster'});
925
+		}
926
+
927
+		if (editor.settings.media_dimensions !== false) {
928
+			var control = SizeManager.createUi(reserialise);
929
+			generalFormItems.push(control);
930
+		}
931
+
932
+		data = getData(editor);
933
+
934
+		var embedTextBox = {
935
+			id: 'mcemediasource',
936
+			type: 'textbox',
937
+			flex: 1,
938
+			name: 'embed',
939
+			value: getSource(editor),
940
+			multiline: true,
941
+			rows: 5,
942
+			label: 'Source'
943
+		};
944
+
945
+		var updateValueOnChange = function () {
946
+			data = Tools.extend({}, HtmlToData.htmlToData(editor.settings.media_scripts, this.value()));
947
+			this.parent().parent().fromJSON(data);
948
+		};
949
+
950
+		embedTextBox[embedChange] = updateValueOnChange;
951
+
952
+		win = editor.windowManager.open({
953
+			title: 'Insert/edit media',
954
+			data: data,
955
+			bodyType: 'tabpanel',
956
+			body: [
957
+				{
958
+					title: 'General',
959
+					type: "form",
960
+					items: generalFormItems
961
+				},
962
+
963
+				{
964
+					title: 'Embed',
965
+					type: "container",
966
+					layout: 'flex',
967
+					direction: 'column',
968
+					align: 'stretch',
969
+					padding: 10,
970
+					spacing: 10,
971
+					items: [
972
+						{
973
+							type: 'label',
974
+							text: 'Paste your embed code below:',
975
+							forId: 'mcemediasource'
976
+						},
977
+						embedTextBox
978
+					]
979
+				},
980
+
981
+				{
982
+					title: 'Advanced',
983
+					type: "form",
984
+					items: advancedFormItems
985
+				}
986
+			],
987
+			onSubmit: function () {
988
+				SizeManager.updateSize(win);
989
+				submitForm(win, editor);
990
+			}
991
+		});
992
+
993
+		SizeManager.syncSize(win);
994
+	};
995
+
996
+	return {
997
+		showDialog: showDialog
998
+	};
999
+});
1000
+define('tinymce.media.core.Sanitize', [
1001
+	'global!tinymce.util.Tools',
1002
+	'global!tinymce.html.Writer',
1003
+	'global!tinymce.html.SaxParser',
1004
+	'global!tinymce.html.Schema'
1005
+], function (Tools, Writer, SaxParser, Schema) {
1006
+	var sanitize = function (editor, html) {
1007
+		if (editor.settings.media_filter_html === false) {
1008
+			return html;
1009
+		}
1010
+
1011
+		var writer = new Writer();
1012
+		var blocked;
1013
+
1014
+		new SaxParser({
1015
+			validate: false,
1016
+			allow_conditional_comments: false,
1017
+			special: 'script,noscript',
1018
+
1019
+			comment: function (text) {
1020
+				writer.comment(text);
1021
+			},
1022
+
1023
+			cdata: function (text) {
1024
+				writer.cdata(text);
1025
+			},
1026
+
1027
+			text: function (text, raw) {
1028
+				writer.text(text, raw);
1029
+			},
1030
+
1031
+			start: function (name, attrs, empty) {
1032
+				blocked = true;
1033
+
1034
+				if (name === 'script' || name === 'noscript') {
1035
+					return;
1036
+				}
1037
+
1038
+				for (var i = 0; i < attrs.length; i++) {
1039
+					if (attrs[i].name.indexOf('on') === 0) {
1040
+						return;
1041
+					}
1042
+
1043
+					if (attrs[i].name === 'style') {
1044
+						attrs[i].value = editor.dom.serializeStyle(editor.dom.parseStyle(attrs[i].value), name);
1045
+					}
1046
+				}
1047
+
1048
+				writer.start(name, attrs, empty);
1049
+				blocked = false;
1050
+			},
1051
+
1052
+			end: function (name) {
1053
+				if (blocked) {
1054
+					return;
1055
+				}
1056
+
1057
+				writer.end(name);
1058
+			}
1059
+		}, new Schema({})).parse(html);
1060
+
1061
+		return writer.getContent();
1062
+	};
1063
+
1064
+	return {
1065
+		sanitize: sanitize
1066
+	};
1067
+});
1068
+defineGlobal("global!tinymce.html.Node", tinymce.html.Node);
1069
+define('tinymce.media.core.Nodes', [
1070
+	'tinymce.media.core.Sanitize',
1071
+	'tinymce.media.core.VideoScript',
1072
+	'global!tinymce.html.Node',
1073
+	'global!tinymce.Env'
1074
+], function (Sanitize, VideoScript, Node, Env) {
1075
+	var createPlaceholderNode = function (editor, node) {
1076
+		var placeHolder;
1077
+		var name = node.name;
1078
+
1079
+		placeHolder = new Node('img', 1);
1080
+		placeHolder.shortEnded = true;
1081
+
1082
+		retainAttributesAndInnerHtml(editor, node, placeHolder);
1083
+
1084
+		placeHolder.attr({
1085
+			width: node.attr('width') || "300",
1086
+			height: node.attr('height') || (name === "audio" ? "30" : "150"),
1087
+			style: node.attr('style'),
1088
+			src: Env.transparentSrc,
1089
+			"data-mce-object": name,
1090
+			"class": "mce-object mce-object-" + name
1091
+		});
1092
+
1093
+		return placeHolder;
1094
+	};
1095
+
1096
+	var createPreviewIframeNode = function (editor, node) {
1097
+		var previewWrapper;
1098
+		var previewNode;
1099
+		var shimNode;
1100
+		var name = node.name;
1101
+
1102
+		previewWrapper = new Node('span', 1);
1103
+		previewWrapper.attr({
1104
+			contentEditable: 'false',
1105
+			style: node.attr('style'),
1106
+			"data-mce-object": name,
1107
+			"class": "mce-preview-object mce-object-" + name
1108
+		});
1109
+
1110
+		retainAttributesAndInnerHtml(editor, node, previewWrapper);
1111
+
1112
+		previewNode = new Node(name, 1);
1113
+		previewNode.attr({
1114
+			src: node.attr('src'),
1115
+			allowfullscreen: node.attr('allowfullscreen'),
1116
+			width: node.attr('width') || "300",
1117
+			height: node.attr('height') || (name === "audio" ? "30" : "150"),
1118
+			frameborder: '0'
1119
+		});
1120
+
1121
+		shimNode = new Node('span', 1);
1122
+		shimNode.attr('class', 'mce-shim');
1123
+
1124
+		previewWrapper.append(previewNode);
1125
+		previewWrapper.append(shimNode);
1126
+
1127
+		return previewWrapper;
1128
+	};
1129
+
1130
+	var retainAttributesAndInnerHtml = function (editor, sourceNode, targetNode) {
1131
+		var attrName;
1132
+		var attrValue;
1133
+		var attribs;
1134
+		var ai;
1135
+		var innerHtml;
1136
+
1137
+		// Prefix all attributes except width, height and style since we
1138
+		// will add these to the placeholder
1139
+		attribs = sourceNode.attributes;
1140
+		ai = attribs.length;
1141
+		while (ai--) {
1142
+			attrName = attribs[ai].name;
1143
+			attrValue = attribs[ai].value;
1144
+
1145
+			if (attrName !== "width" && attrName !== "height" && attrName !== "style") {
1146
+				if (attrName === "data" || attrName === "src") {
1147
+					attrValue = editor.convertURL(attrValue, attrName);
1148
+				}
1149
+
1150
+				targetNode.attr('data-mce-p-' + attrName, attrValue);
1151
+			}
1152
+		}
1153
+
1154
+		// Place the inner HTML contents inside an escaped attribute
1155
+		// This enables us to copy/paste the fake object
1156
+		innerHtml = sourceNode.firstChild && sourceNode.firstChild.value;
1157
+		if (innerHtml) {
1158
+			targetNode.attr("data-mce-html", escape(Sanitize.sanitize(editor, innerHtml)));
1159
+			targetNode.firstChild = null;
1160
+		}
1161
+	};
1162
+
1163
+	var isWithinEphoxEmbed = function (node) {
1164
+		while ((node = node.parent)) {
1165
+			if (node.attr('data-ephox-embed-iri')) {
1166
+				return true;
1167
+			}
1168
+		}
1169
+
1170
+		return false;
1171
+	};
1172
+
1173
+	var placeHolderConverter = function (editor) {
1174
+		return function (nodes) {
1175
+			var i = nodes.length;
1176
+			var node;
1177
+			var videoScript;
1178
+
1179
+			while (i--) {
1180
+				node = nodes[i];
1181
+				if (!node.parent) {
1182
+					continue;
1183
+				}
1184
+
1185
+				if (node.parent.attr('data-mce-object')) {
1186
+					continue;
1187
+				}
1188
+
1189
+				if (node.name === 'script') {
1190
+					videoScript = VideoScript.getVideoScriptMatch(editor.settings.media_scripts, node.attr('src'));
1191
+					if (!videoScript) {
1192
+						continue;
1193
+					}
1194
+				}
1195
+
1196
+				if (videoScript) {
1197
+					if (videoScript.width) {
1198
+						node.attr('width', videoScript.width.toString());
1199
+					}
1200
+
1201
+					if (videoScript.height) {
1202
+						node.attr('height', videoScript.height.toString());
1203
+					}
1204
+				}
1205
+
1206
+				if (node.name === 'iframe' && editor.settings.media_live_embeds !== false && Env.ceFalse) {
1207
+					if (!isWithinEphoxEmbed(node)) {
1208
+						node.replace(createPreviewIframeNode(editor, node));
1209
+					}
1210
+				} else {
1211
+					if (!isWithinEphoxEmbed(node)) {
1212
+						node.replace(createPlaceholderNode(editor, node));
1213
+					}
1214
+				}
1215
+			}
1216
+		};
1217
+	};
1218
+
1219
+	return {
1220
+		createPreviewIframeNode: createPreviewIframeNode,
1221
+		createPlaceholderNode: createPlaceholderNode,
1222
+		placeHolderConverter: placeHolderConverter
1223
+	};
1224
+});
1225
+/**
1226
+ * plugin.js
1227
+ *
1228
+ * Released under LGPL License.
1229
+ * Copyright (c) 1999-2015 Ephox Corp. All rights reserved
1230
+ *
1231
+ * License: http://www.tinymce.com/license
1232
+ * Contributing: http://www.tinymce.com/contributing
1233
+ */
1234
+
1235
+/*jshint maxlen:255 */
1236
+/*eslint max-len:0 */
1237
+/*global tinymce:true */
1238
+
1239
+define('tinymce.media.Plugin', [
1240
+	'global!tinymce.PluginManager',
1241
+	'tinymce.media.ui.Dialog',
1242
+	'tinymce.media.core.Sanitize',
1243
+	'tinymce.media.core.UpdateHtml',
1244
+	'tinymce.media.core.Nodes'
1245
+], function (PluginManager, Dialog, Sanitize, UpdateHtml, Nodes) {
1246
+	var Plugin = function (editor) {
1247
+		editor.on('ResolveName', function (e) {
1248
+			var name;
1249
+
1250
+			if (e.target.nodeType === 1 && (name = e.target.getAttribute("data-mce-object"))) {
1251
+				e.name = name;
1252
+			}
1253
+		});
1254
+
1255
+		editor.on('preInit', function () {
1256
+			// Make sure that any messy HTML is retained inside these
1257
+			var specialElements = editor.schema.getSpecialElements();
1258
+			tinymce.each('video audio iframe object'.split(' '), function (name) {
1259
+				specialElements[name] = new RegExp('<\/' + name + '[^>]*>', 'gi');
1260
+			});
1261
+
1262
+			// Allow elements
1263
+			//editor.schema.addValidElements('object[id|style|width|height|classid|codebase|*],embed[id|style|width|height|type|src|*],video[*],audio[*]');
1264
+
1265
+			// Set allowFullscreen attribs as boolean
1266
+			var boolAttrs = editor.schema.getBoolAttrs();
1267
+			tinymce.each('webkitallowfullscreen mozallowfullscreen allowfullscreen'.split(' '), function (name) {
1268
+				boolAttrs[name] = {};
1269
+			});
1270
+
1271
+			// Converts iframe, video etc into placeholder images
1272
+			editor.parser.addNodeFilter('iframe,video,audio,object,embed,script',
1273
+				Nodes.placeHolderConverter(editor));
1274
+
1275
+			// Replaces placeholder images with real elements for video, object, iframe etc
1276
+			editor.serializer.addAttributeFilter('data-mce-object', function (nodes, name) {
1277
+				var i = nodes.length;
1278
+				var node;
1279
+				var realElm;
1280
+				var ai;
1281
+				var attribs;
1282
+				var innerHtml;
1283
+				var innerNode;
1284
+				var realElmName;
1285
+				var className;
1286
+
1287
+				while (i--) {
1288
+					node = nodes[i];
1289
+					if (!node.parent) {
1290
+						continue;
1291
+					}
1292
+
1293
+					realElmName = node.attr(name);
1294
+					realElm = new tinymce.html.Node(realElmName, 1);
1295
+
1296
+					// Add width/height to everything but audio
1297
+					if (realElmName !== "audio" && realElmName !== "script") {
1298
+						className = node.attr('class');
1299
+						if (className && className.indexOf('mce-preview-object') !== -1) {
1300
+							realElm.attr({
1301
+								width: node.firstChild.attr('width'),
1302
+								height: node.firstChild.attr('height')
1303
+							});
1304
+						} else {
1305
+							realElm.attr({
1306
+								width: node.attr('width'),
1307
+								height: node.attr('height')
1308
+							});
1309
+						}
1310
+					}
1311
+
1312
+					realElm.attr({
1313
+						style: node.attr('style')
1314
+					});
1315
+
1316
+					// Unprefix all placeholder attributes
1317
+					attribs = node.attributes;
1318
+					ai = attribs.length;
1319
+					while (ai--) {
1320
+						var attrName = attribs[ai].name;
1321
+
1322
+						if (attrName.indexOf('data-mce-p-') === 0) {
1323
+							realElm.attr(attrName.substr(11), attribs[ai].value);
1324
+						}
1325
+					}
1326
+
1327
+					if (realElmName === "script") {
1328
+						realElm.attr('type', 'text/javascript');
1329
+					}
1330
+
1331
+					// Inject innerhtml
1332
+					innerHtml = node.attr('data-mce-html');
1333
+					if (innerHtml) {
1334
+						innerNode = new tinymce.html.Node('#text', 3);
1335
+						innerNode.raw = true;
1336
+						innerNode.value = Sanitize.sanitize(editor, unescape(innerHtml));
1337
+						realElm.append(innerNode);
1338
+					}
1339
+
1340
+					node.replace(realElm);
1341
+				}
1342
+			});
1343
+		});
1344
+
1345
+		editor.on('click keyup', function () {
1346
+			var selectedNode = editor.selection.getNode();
1347
+
1348
+			if (selectedNode && editor.dom.hasClass(selectedNode, 'mce-preview-object')) {
1349
+				if (editor.dom.getAttrib(selectedNode, 'data-mce-selected')) {
1350
+					selectedNode.setAttribute('data-mce-selected', '2');
1351
+				}
1352
+			}
1353
+		});
1354
+
1355
+		editor.on('ObjectSelected', function (e) {
1356
+			var objectType = e.target.getAttribute('data-mce-object');
1357
+
1358
+			if (objectType === "audio" || objectType === "script") {
1359
+				e.preventDefault();
1360
+			}
1361
+		});
1362
+
1363
+		editor.on('objectResized', function (e) {
1364
+			var target = e.target;
1365
+			var html;
1366
+
1367
+			if (target.getAttribute('data-mce-object')) {
1368
+				html = target.getAttribute('data-mce-html');
1369
+				if (html) {
1370
+					html = unescape(html);
1371
+					target.setAttribute('data-mce-html', escape(
1372
+						UpdateHtml.updateHtml(html, {
1373
+							width: e.width,
1374
+							height: e.height
1375
+						})
1376
+					));
1377
+				}
1378
+			}
1379
+		});
1380
+
1381
+		this.showDialog = function () {
1382
+			Dialog.showDialog(editor);
1383
+		};
1384
+
1385
+		editor.addButton('media', {
1386
+			tooltip: 'Insert/edit media',
1387
+			onclick: this.showDialog,
1388
+			stateSelector: ['img[data-mce-object]', 'span[data-mce-object]', 'div[data-ephox-embed-iri]']
1389
+		});
1390
+
1391
+		editor.addMenuItem('media', {
1392
+			icon: 'media',
1393
+			text: 'Media',
1394
+			onclick: this.showDialog,
1395
+			context: 'insert',
1396
+			prependToContext: true
1397
+		});
1398
+
1399
+		editor.on('setContent', function () {
1400
+			// TODO: This shouldn't be needed there should be a way to mark bogus
1401
+			// elements so they are never removed except external save
1402
+			editor.$('span.mce-preview-object').each(function (index, elm) {
1403
+				var $elm = editor.$(elm);
1404
+
1405
+				if ($elm.find('span.mce-shim', elm).length === 0) {
1406
+					$elm.append('<span class="mce-shim"></span>');
1407
+				}
1408
+			});
1409
+		});
1410
+
1411
+		editor.addCommand('mceMedia', this.showDialog);
1412
+	};
1413
+
1414
+	PluginManager.add('media', Plugin);
1415
+
1416
+	return function () {};
1417
+});
1418
+
1419
+
1420
+dem('tinymce.media.Plugin')();
1421
+})();